Syntax Error on testing the APIs with npx command

Hello everyone I am having a problem with testing the api. When I run all the other tests in mock, my backend is updated and I see what I created,updated,deleted,etc. But when I run the command(I’m omitting alot of details but do let me know if there could be an issue there.I made sure all my tokens were correct. Also ‘body’ is my main question here): npx aws-api-gateway-cli-test --api-gateway-region us-east-1 --path-template /requests --method POST --body "{\"content\":\"test req\",\"amount\":\"120\",\"attachment\":\"bye.jpg\"}"

its giving me this error:

Authenticating with User Pool
Getting temporary credentials
Making API request

SyntaxError: Unexpected token \ in JSON at position 1
    at JSON.parse (<anonymous>)
    at makeRequest (C:\Users\aamai\AppData\Roaming\npm-cache\_npx\18348\node_modules\aws-api-gateway-cli-test\index.js:179:17)
    at C:\Users\aamai\AppData\Roaming\npm-cache\_npx\18348\node_modules\aws-api-gateway-cli-test\index.js:152:5
    at C:\Users\aamai\AppData\Roaming\npm-cache\_npx\18348\node_modules\aws-api-gateway-cli-test\node_modules\aws-sdk\lib\credentials.js:124:23
    at C:\Users\aamai\AppData\Roaming\npm-cache\_npx\18348\node_modules\aws-api-gateway-cli-test\node_modules\aws-sdk\lib\credentials.js:212:15
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

I’m not too sure what I’m doing wrong. I’m trying to fix the syntax error but I’m extremely stuck :frowning:
Can I get some help please. I’m on Windows 10!

It looks like someone is helping you over on GitHub.

1 Like

Yup, I got it figured out!

Can you please explain, how you figured that out?
I’m still facing this issue on both command prompt and git bash in vs code - windows

1 Like