Comments for Test the APIs

Hi. I am totally new to aws and I find this tutorial very good for people like me. I have passed the local function invokes with not much problem but now I am facing 502 Bad Gateway error now. Lambda function test result is as follows:

  "errorMessage": "Cannot find module 'babel-runtime/regenerator'",
  "errorType": "Error",
  "stackTrace": [
    "Function.Module._load (module.js:474:25)",
    "Module.require (module.js:596:17)",
    "require (internal/module.js:11:18)",
    "Object.<anonymous> (/var/task/create.js:97:18)",
    "__webpack_require__ (/var/task/create.js:20:30)",
    "Object.<anonymous> (/var/task/create.js:193:20)",
    "__webpack_require__ (/var/task/create.js:20:30)",
    "Object.<anonymous> (/var/task/create.js:87:10)"

cmd is as follows:

npx aws-api-gateway-cli-test --username --password Passw0rd! --user-pool-id us-west-2_xxxxxxxxx --app-client-id xxxxxxxxxxxxxxxx --cognito-region us-west-2 --identity-pool-id us-west-2:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --invoke-url --api-gateway-region us-west-2 --path-template /notes --method POST --body "{\"content\":\"hello again\",\"attachment\":\"hi.jpg\"}"

I would really appreciate if anyone could help me out with this error. Thanks in advance. :grinning:

This is my repository

Do you get that error that you posted when you run the test command or is that error coming from the Lambda logs?

Can you check the API Gateway or Lambda logs?

Struggled for an embarrassingly long time in trying to solve this, and finally came across your reply. Thank you kind person!

1 Like

@nmahurin glad someone found it useful

1 Like

Hi, I had a similar problem to someone else but can’t find it here anymore.

missing required arguments: password, user-pool-id, app-client-id, identity-pool-id, invoke-url, path-template,

I am using the right URL and double-checked everything.

Thank you in advance for any advice.

Hi, I get the below error whenever I run the command.
Authenticating with User Pool Getting temporary credentials Making API request { status: 404, statusText: 'Not Found', data: { message: 'No method found matching route / for http method POST.' } }

This is my command I run:
npx aws-api-gateway-cli-test --username='' --password='Admin123!' --user-pool-id='us-east-1_n2u1yS41s' --app-client-id='1lmq66tkudd4ajiak3vhginpam' --cognito-region='us-east-1' --identity-pool-id='us-east-1:0d942a90-e09a-4bbe-96be-5df6436c813f' --invoke-url='' --api-gateway-region='us-east-1' --path-template= '/notes' --method='POST' --body='{"content":"hello world","attachment":"hello.jpg"}'

I’ve cross checked my credentials x2
Thank you in advance…

This error sounds like your API doesn’t have a POST method for that route? Can you make sure that you are able to test that using serverless invoke local before testing it through API Gateway?

This usually happens if the command is not formatted correctly. Can you make sure the quotes around those parameters are set correctly? If you copied it from the PDF it can sometimes be incorrect.

Invalid UserPoolId format.

As stated before Windows shell dislikes the quoting. I didn’t see a solution, so sorry if this is already posted. The following quoting & escape scheme will work on Windows.

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

Hi Jay,
Thank you for responding, yes I did test locally. So I re did the tutorial from start. But now I get this error

Authenticating with User Pool
Getting temporary credentials

Making API request

getaddrinfo ENOTFOUND

Totally lost at this point…

This error seems more like a network issue. Just make sure you have access to that domain.

Thanks for posting this!

Hello I keep getting the following message

bash: --invoke-url= No such file or directory

When I run

npx aws-api-gateway-cli-test \
> > --username='' \
> > --password='Passw0rd!' \
> > --user-pool-id='us-east-2_rTqoSIqQc' \
> > --app-client-id='3da48ufo9nvn3a26c1nsilt6r3' \
> > --cognito-region='us-east-2' \
> > --identity-pool-id='us-east-2:32c70d8c-c23f-4a34-a9e3-6c39ebf07e97' \
> > --invoke-url='' \
> > --api-gateway-region='us-east-2' \
> > --path-template='/notes' \
> > --method='POST' \
> > --body='{"content":"hello world","attachment":"hello.jpg"}'

And this is what my service information looks like
Service Information

service: notes-app-api

stage: prod

region: us-east-2

stack: notes-app-api-prod

resources: 35

api keys:





create: notes-app-api-prod-create

get: notes-app-api-prod-get

list: notes-app-api-prod-list

update: notes-app-api-prod-update

delete: notes-app-api-prod-delete



I really don’t know what I’m doing wrong.


These errors are usually related to the CLI command not being formatted correctly. Can you paste the exact command you are using?

Thanks I actually went back and remade my user pool and app client, and it worked.

I am getting the status 403 error

Making API request
{ status: 403,
  statusText: 'Forbidden',
  data: { message: 'Forbidden' } }
  1. have deleted and recreated by identity pool
  2. attached administrator policy to Cognito roles

Any other ideas?

Hmmm you might want to take a look at this chapter to debug this. Specifically using the Policy Simulator.

How do you format the path-template to test the other methods?