mikegillis677 / actions-on-lambda

Run Actions on Google in an AWS Lambda Environment
MIT License
1 stars 0 forks source link

Uncaught SyntaxError: Unexpected token o in JSON at position 1 #1

Closed ajayarjun-bka closed 6 years ago

ajayarjun-bka commented 6 years ago

@mikegillis677

Cannot get it working, should the event or context be stringified before passing to the functions. I am using a api gateway with lambda proxy integration.

this is the error

2018-07-10T16:19:25.965Z 021bc75c-845d-11e8-92fb-6525af515a1d SyntaxError: Unexpected token # in JSON at position 0 at JSON.parse () at createStrictSyntaxError (/var/task/node_modules/body-parser/lib/types/json.js:157:10) at parse (/var/task/node_modules/body-parser/lib/types/json.js:83:15) at /var/task/node_modules/body-parser/lib/read.js:121:18 at invokeCallback (/var/task/node_modules/raw-body/index.js:224:16) at done (/var/task/node_modules/raw-body/index.js:213:7) at IncomingMessage.onEnd (/var/task/node_modules/raw-body/index.js:273:7) at emitNone (events.js:106:13) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12)

mikegillis677 commented 6 years ago

@ajayarjun-bka Sorry to hear that you're having issues. It sounds very strange, since that's the exact setup I'm using for my own Actions on Google app. How are you invoking the action that is causing the error? Are you using the Actions on Google Console simulator? I'll have some time tomorrow to take a look at this, and I'll try spinning up a hello world Action as a new project to see if I can't reproduce the problem you're experiencing.

mikegillis677 commented 6 years ago

@ajayarjun-bka I took a look at the problem, and it looks like there's been a major update to Dialogflow and the actions-on-google package that I wasn't aware of. It looks like with version 2.0 of actions-on-google available at https://github.com/actions-on-google/actions-on-google-nodejs, AWS Lambda is supported out of the box. So I'd recommend using that.

In light of this, I'm going to update the README to recommend Actions on Google version 2, and deprecate the package on npm.

ajayarjun-bka commented 6 years ago

@mikegillis677 Yes I realized it after digging in a little bit. And as you V2 supports it put of the box.