Comments for Test the APIs


You might have to login to your AWS console and the User Pool to see what is going on. I might just create another user and use that?


I skiped this phase and solved the challenge using the front end.

With Cognito when you create a user the first password is temporary and needs to be change at first connexion.


I see. Glad you figured it out.


When testing the API I am continually seeing an error: Missing required arguments: identity-pool-id, invoke-url, path-template zsh: command not found: --identity-pool-id=us-east-2:3139818b-a595-44ae-87b7-1841c3a07fa3

I checked multiple times to ensure that the correct values are being passed. The correct regions are specified. The format is correct - i copy and pasted from the tutorial. I manually typed in --identity-pool-id='us-east-2:3139818b-a595-44ae-87b7-1841c3a07fa3' \ in case there was a character encoding mismatch. What else could be the problem?

--username '' \
--password='Passw0rd!' \
--user-pool-id='us-east-2_Yqa7o7Dp6' \
--app-client-id='7tnd9tlojl69ktim5la48r1iao' \
--cognito-region='us-east-2' \
--identity-pool-id='us-east-2:3139818b-a595-44ae-87b7-1841c3a07fa3' \
--invoke-url='' \
--api-gateway-region='us-east-2' \
--path-template='/notes' \
--method='POST' \
--body='{"content":"hello world","attachment":"hello.jpg"}'

The error sounds like it is saying that the command is not in the right format. It thinks that identity-pool-id=us-east-2:3139818b-a595-44ae-87b7-1841c3a07fa3 is the command you are trying to run.

Can you post the full command you are trying to run?


yes it is an issue with power shell and it works on CMD

1 Like

This seems like a basic question but I cant figure out how to console.log in my Lambda function


You can add the console.log just as you would normally. But you need to look at the Lambda logs to see them. You can read up here on how to set them up.


hello, I’m getting this error when running aws-api-gateway-cli-test command

Authenticating with User Pool
Getting temporary credentials
Making API request
{ status: 403,
  statusText: 'Forbidden',
  data: { message: 'Forbidden' } }

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