Unexpected Token Analysis Server Response

I am working on creating a Parse Server on Heroku. I am using this app:

https://github.com/ParsePlatform/parse-server-example

Loading into a hero using this guide:

https://devcenter.heroku.com/articles/getting-started-with-nodejs

I updated the db and server urls in the analysis server code and everything loads and deploys correctly. However, when I try to use cURL to test the server, as indicated in this guide:

https://github.com/ParsePlatform/parse-server

I get the following error:

{"error":"Unexpected token '"} 

I copied and pasted the cURL command modified for my URL:

 curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' http://my-app-name.herokuapp.com/parse/classes/GameScore 

Heroku logs show a request coming in (so I know it goes in the right place) but no errors. I use Windows 7 if that matters. This is my first experience working with a server hero and parsing, so I'm kind of flying blind. Does anyone see a problem?

+5
source share
2 answers

Try converting a simple quote to a double quote for the POST data field, it works for me:

 #here : "{'score':1337,'playerName':'Sean Plott','cheatMode':false}" curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d "{'score':1337,'playerName':'Sean Plott','cheatMode':false}" http://my-app-name.herokuapp.com/parse/classes/GameScore 

instead

 #here : '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' curl -X POST -H "X-Parse-Application-Id: myAppId" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' http://my-app-name.herokuapp.com/parse/classes/GameScore 
0
source

I had this problem - there was a fix for me: I used the restApi key, which is no longer needed in Parse-Server.

It also affected my s3 adapter - it did not allow me to upload any images through the toolbar.

I deleted the restApi key and it all started.

0
source

Source: https://habr.com/ru/post/1247985/


All Articles