r/GoogleAssistantDev • • Aug 29 '19

Continuous development and testing best practice for Dialogflow and Firebase Node.js backend

UPDATE: For those of you interested, I've managed to tackle this by moving to Google App Engine node.js environment. It's a bit of a tweak and setup but i think in the long run it will be easier. App engine handles versioning very well. Every time you deploy you get a version stamp on an internal url so i can easily deploy with that version stamped url! I ended up then needing to only use one google action project for both test and production!. A good read on this https://medium.com/weareservian/migrating-dialogflow-webhook-from-cloud-function-to-app-engine-6835a3dd52c1 by Scott Shellien-Walker on Medium. Also seems my issue has been posted before in Stack Overflow here https://stackoverflow.com/questions/51459430/how-do-i-synchronize-aog-releases-to-versions-of-my-fulfillment-on-firebase-func by wolak

Hi,

I am new to Google Actions and currently just submitted an action that is under review.

The action I am developing currently uses DialogFlow and Firebase node.js back end. I want the development work and testing to continue rather than wait for the review to be completed. As the development is moving quite quickly, the cycle of submission and testing will be quite frequent.

What are your thoughts on making sure that I am not compromising production DialogFlow and Firebase functions backend?

i.e. Do i create two action, one always for production and another for test? like Action Name and Action Name Testing?

Or is there any other way like I've read somewhere that one the app is in production, the Dialog flow updates will not affect production, if that's the case, how do I "See" a production version of DialogFlow?

Thanks in advance for your thoughts!

3 Upvotes

7 comments sorted by

View all comments

1

u/cgilhoi Aug 29 '19

I would create two actions as you have suggested. Technically, the changes you make in Dialogflow should not impact the production version of the app but as far as I know there isn't a way to create a production and test version of the same action (versions and environments is still in beta).

1

u/goldzulu Aug 29 '19

Thanks. I guess that seems to be the best way. I was halfway reading through the alpha and beta environments https://developers.google.com/actions/deploy/release-environments but don't have the confidence is using them as I am unsure of the impact and relationship between Action Console <-> DialogFlow <-> Firebase functions!

1

u/afirstenberg GDE Aug 29 '19

I concur with this. Although AoG and Dialogflow have versioning/environments, I've always been a little... anxious... trying to use them. And since Cloud Functions don't have the same thing, it makes it a lot more difficult to treat a project as a cohesive whole.

While I do have the separate development and test projects, there is still the problem that once I'm ready to deploy, there is still this period where I have deployed something "to production", but it hasn't been approved yet, so the Function may be the new version, but users are still accessing the older UI.

I haven't found a good solution for this yet, and would love to hear what others are doing.

1

u/goldzulu Aug 30 '19

Hey, I know exactly what you are talking about!

BTW I've updated my post above. I've found pretty much the best solution so far. I'll probably write a blog article about this when I find some time.

In general, I've adopted a way and now happily testing confidently using this new method. I've adopted the Google App Engine node.js path.

Love to hear from anyone out there if there are some pitfalls on going down this path but so far I have found it to be much much better.

In short, GAE allows you to have versions for every time you deploy. A base url you use will always be the "head" so called bleeding edge. e.g. https://yourfullfillmentprojectid.appspot.com. Every other version you deployed will look like this https://121212312321312-dot-yourfullmentprojectid.appspot.com.The trick is to copy the unique version url just before you submit to production and use that as your fulfilment url. This will cause that production version to be locked to that version of the deployment! GAE infrastructure will "split" the traffic for each version deployed if its explicitly calling the version stamped version of the url. When i commit my code to git and tag it, i also put the version stamp onto my commit message so i know exactly the code that is for that particular version.

By using the above method i only need one project! Hope that helps. It's a bit tricky but not hard to change the code to GAE. GAE uses node10, a app.yaml that you have to have and you will need to use express to serve (firebase cloud functions handled this automatically before). Let me know if you have any questions.

1

u/goldzulu Aug 29 '19

I've gone and implemented the two actions way. However I'm still stuck with the fulfilment part for the functions when it comes to deployment new versions.

I was thinking of round robin swapping the two fulfilment urls on firebase functions. I.e. when ready i update the fulfilment urls in the draft version to point to the test fulfilment url and then submit the draft for production. Hence test fulfilment becomes prod fulfilment. But then i am stuck without the ability to test until that new version gets published -> having then to create a third action app! Perhaps there is a more sane approach?

1

u/cgilhoi Aug 29 '19

You can always choose the draft version to test on the simulator. You can also create an alpha version.

1

u/goldzulu Aug 30 '19

Hey, I've updated my post above and also commented on another comment above but I've found a solution (me thinks!). I think the key is to find a solution for the fulfilment part. I've used the draft version as you've suggested for the "front" ends. Thanks for your comment earlier!