actions-on-google-nodejs icon indicating copy to clipboard operation
actions-on-google-nodejs copied to clipboard

SyntaxError excpetion thrown in response of requestSync method is not rejected properly and crashes

Open aidinrs opened this issue 6 years ago • 2 comments
trafficstars

If response of the call to requestSync method is not in proper JSON then the response handler throws SyntaxError exception at JSON.parse, without rejecting the promise causing the whole node application to crash. it should be wrapped around a try-catch block and rejected properly.

aidinrs avatar Oct 11 '19 22:10 aidinrs

So you're calling requestSync with some data, but for some reason it fails and it sends you a non-JSON body?

Fleker avatar Oct 14 '19 14:10 Fleker

@Fleker yes, I saw it in the logs a few times. I saw 403 unauthorized errors. Anyway, there certainly is a chance of it failling thus it should be wrapped around try-catch. for example google service not responding properly, being down or if you proxied the request and the proxy being down, .... this should not take my whole application down.

aidinrs avatar Oct 20 '19 09:10 aidinrs