Testing the APIs gives a SyntaxError: Unexpected token : in JSON at position XX

I double and triple checked my AWS configurations but am still getting a syntax error when running the test api gateway NPM module: here is the command I am running:

npx aws-api-gateway-cli-test --username='leeerick@amazon.com' --password='XXXX' --user-pool-id='us-west-XXXX' --app-client-id='XXXX' --cognito-region='us-west-2' --identity-pool-id='us-west-2:XXXX' --invoke-url='https://XXXX.execute-api.us-west-2.amazonaws.com/dev' --api-gateway-region='us-west-2' --path-template='/notes' --method='POST' --body='{"content":"hello Erick Lee”,”attachment":"hello.jpg"}'

I don’t believe I need to escape any special characters since I am using single quotes but I am open to suggestions. I am loving the walk-through and hope I can get past this point.

Just looking at the formatting for the --body parameter, it seems like the double-quote used for ”attachment" is inconsistent. It might be a copy-paste thing but just make sure the it is the right character, like so "attachment".

I think it’s the same issue here as well - "hello Erick Lee”.

I will try that, thanks!

Thanks jayair that was the problem!

1 Like