AnomalyInnovations / serverless-stack-demo-client

Source for the demo app client in the Serverless Stack Guide
https://demo2.serverless-stack.com
MIT License
635 stars 204 forks source link

SyntaxError: Unexpected end of JSON input #10

Closed death667b closed 6 years ago

death667b commented 6 years ago

What is happening:

When posting a new note on /notes/new a alert error is displayed 'SyntaxError: Unexpected end of JSON input'. No note is posted to AWS

What is expected to happen:

Note is posted to AWS without error

Steps to reproduce

In ./src/libs/awsLib.js -> Function invokeApi If the return has results.json() on the end the error will display. Removing .json() will post the note.

However, if .json() is remove when displaying the default route (./src/containers/Home.js) then the web app fails with error 'Unhandled Rejection (TypeError): Cannot read property 'trim' of undefined'

jayair commented 6 years ago

@death667b Hmmm I don't think I could reproduce it on my end. So I suspect the issue might be with the create note API. Can you check the console for what is returned when calling /notes/new? Both the response body and headers?

death667b commented 6 years ago

@jayair Thanks for the suggestion to look at the create note API. I had a typo in callback(null, success(params.Item)); in the try catch block.

I had typed params.items - missing the capital I