Test the Configured APIs

I’m also getting the message: Error: Request failed with status code 500, when I build the React app for dev, run it locally, and try to do anything in the Notes app that requires an API call (ie. create a new note).

I’m not sure where the best place to post this issue would be, so if you point me in the right direction I can move this comment.

I resolved my status code 500 issue by making the changes found here:

1 Like

Oh I’m glad that helped you out!

I am get a 403 error when I try to test the api-gateway.

$ npx aws-api-gateway-cli-test
–body=’{“content”:“hello world”,“attachment”:“hello.jpg”}’

npx: installed 105 in 33.656s
Authenticating with User Pool
Getting temporary credentials
Making API request
{ status: 403,
statusText: ‘Forbidden’,
data: { message: ‘Forbidden’ } }

I just started with Part II of the App and got to this part and can not get it to work. I have enabled logs and nothing shows up in any cloudwatch logs. I tested the api in the policy simulator and that worked. and Seed does not show any messages when I enable the logs.
Any suggestions on other things to test?


This is for anyone that may be using a Windows 10 system and having problems with 403 errors…

After many hours of testing, checking, etc and finally making a minor edit to apig-test to dump the entire “response” from the API Request when there is an error, I finally got this to work.
I am not 100% sure WHY it works, but it is probably Windows 10 and the shell I am using…

To start, I had all kinds of problems getting either the Command shell or powershell on windows 10 to accept all the parameters. I tried many attempts to escape the quotes and never got the command to work.
So I used Git Bash. It was easy to edit the line in notepad then paste into git bash and the command executed.

However, I was getting the 403 error. I double checked all the roles, policies, etc and they were correct.

So when I got apig-test to display the entire response message I found something strange…
in the headers that was sent to AWS is

POST /dev/C:/Program%20Files/Git/notes HTTP/1.1…

Where is the “C:/Program%20Files/Git/” coming from??? It is not in the command line.
To make an already long story shorter…
I fixed the problem by making a very simple change to the command line…



After these simple edits to the URL to add trailing / and to path-template to remove leading /


IT WORKED!!! ??? !!!

If someone can explain this, I would love to know…
In the mean time, I am pressing on with this awesome tutorial.
Hopefully someone finds this helpful.


That’s really weird. Not sure what is going on there. But thanks for the detailed write-up. I’m sure it’ll help other Windows users.

1 Like

I have run the following npx command on dev:

npx aws-api-gateway-cli-test \
--username='admin@example.com' \
--password='Passw0rd!' \
--user-pool-id='us-east-1_fZ3XofyFi' \
--app-client-id='2embh2inkauuieqtbll9uisk62' \
--cognito-region=‘us-east-1’ \
--identity-pool-id='us-east-1:2a9a76ff-e661-4ed2-b1a1-17434326dfa3' \
--invoke-url='https://2bbhwgva13.execute-api.us-east-1.amazonaws.com/dev' \
--api-gateway-region=‘us-east-1’ \
--path-template='/notes' \
--method='POST' \
--body='{"content":"hello world","attachment":"hello.jpg"}'

…and get the following error:

npx: installed 105 in 4.695s
Authenticating with User Pool
Getting temporary credentials
Inaccessible host: `cognito-identity.xn--us-east-1-499dua.amazonaws.com'. This service may not be available in the `‘us-east-1’' region.

Update: I had copied and pasted the command from the tutorial instructions, and for some reason the apostrophes around the ‘us-east-1’ were different than all the other normal apostrophes. I fixed them, and now it works.

1 Like

Thanks for reporting back. Yeah the copy-paste from the PDF is not great. Try using the web version if you can.

I’m stuck on a 500 error… can anyone help?

Here’s the error logged in Seed for my /create lambda:

It looks It like the table name attempting to be updated is “notes,” where it should be “dev-notes.”

When I tested with the tableName hard-coded in the serverless.yml, it worked fine… solved my own problem, guys. I’d skimmed over the part in the tutorial about replacing the tableName variable under the environment block. Doh! Leaving this post here, in case anyone else runs into the same issue.


Glad you figured it out. Thanks for reporting back.

Windows users testing the API: Especially if using VS Code or Powershell
VS Code uses powershell, and it doesn’t seem to like the JSON in the body section

Use a normal windows command prompt when testing the API: run as admin
And use this syntax. This should work with no problems as long as all your CORS settings are correct: This is for both dev and prod, so update the script accordingly, with your credentials

npx aws-api-gateway-cli-test --username admin@example.com --password Passw0rd! --user-pool-id us-east-1_xxxxxxxxx --app-client-id xxxxxxxxxxxxxxxxxxxxxxxxx --cognito-region us-east-1 --identity-pool-id us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --invoke-url https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/prod --api-gateway-region us-east-1 --path-template /notes --method POST --body "{\"content\":\"hello world\",\"attachment\":\"hello.jpg\"}"

Thanks for posting this!

@bwsolutions thanks for your comments. I got a 403 response then tried moving the leading and trailing / as per your instructions and it was successful - returns 200 now. I am also using Git Bash on Windows 10.

1 Like

You sir, are the true MVP. Thanks for this solution, worked like a charm.

1 Like

This formatting for windows also worked for me, thank you.

1 Like

I’m having an issue where terminal returns: “npx: installed 105 in 9.913s
Authenticating with User Pool
Getting temporary credentials
Token is not from a supported provider of this identity pool.” Any ideas?

It appears to have been an issue with using the wrong App Client ID.

1 Like

Glad you figured it out.

Fair play bwsolutions! This sorted me out as well. Sign him y’all!! :smiley:

1 Like