I'm developing my first Action for Google Assistant using IntelliJ Community and Java/Kotlin Client library to develop fulfillment code. Is there a way to debug it locally in typical way (using breakpoints)?
2 Answers
As the code is going to be run remotely on a server, you can't debug locally in a typical way. One way to debug is using logging, printing out key variables and checking them to gain an understanding of values/flow.
However, if you are using Google Cloud, you can look at using Stackdriver Debug Snapshots. It won't halt execution, but will take a snapshot of the application state at that time so that you can go back and see on which line what your variables are.

- 11,536
- 1
- 21
- 35
I didn't give up and I did it. Debug Actions on Google's fullfilment locally in typical way is possible.
To do that, I used: IntelliJ Community Edition and ngrok.
- Deploy and run/debug the fullfilment on the local AppEngine server (guide).
- Run ngrok to obtain public URL for exposing your local application (using command line "ngrok.exe http {portNumber}").
- Copy and paste the https URL on Dialogflow > Fullfilment > Webhook > URL.
- Test your Action on Action Console.
When your fullfilment will recive a Post Request from DialogFlow, your application will stop at breakpoints and you'll be able to debug in the typical way.
The only downside to this solution is that Google Assistant's waiting time for the response from fullfilment is limited, and so while you're debugging, at some point your Action may stop showing the message "YourApp isn't responding right now. Try again soon.". However, this solution allows a very rapid deployment and debugging, and personally I really appreciate it in the development phase.

- 148
- 1
- 11