When trying to run the aws-api-gateway-cli-test command, I get the following error:
Authenticating with User Pool
Getting temporary credentials
Making API request
/usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-sdk/lib/request.js:31
throw err;
^
TypeError: Cannot read property ‘1’ of null
at Object.apigClientFactory.newClient (/usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-api-gateway-client/dist/apigClient.js:63:57)
at makeRequest (/usr/local/lib/node_modules/aws-api-gateway-cli-test/index.js:157:38)
at /usr/local/lib/node_modules/aws-api-gateway-cli-test/index.js:150:5
at /usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-sdk/lib/credentials.js:123:23
at Response. (/usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-sdk/lib/credentials/cognito_identity_credentials.js:258:7)
at Request. (/usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-sdk/lib/request.js:364:18)
at Request.callListeners (/usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-sdk/lib/sequential_executor.js:109:20)
at Request.emit (/usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-sdk/lib/sequential_executor.js:81:10)
at Request.emit (/usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/usr/local/lib/node_modules/aws-api-gateway-cli-test/node_modules/aws-sdk/lib/request.js:22:10)
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.
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…
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.
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.
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.
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
@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.
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?