amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

API gateway gives cannot GET / after creation api with "amplify add api"

Open bitlejac opened this issue 6 years ago • 5 comments

Describe the bug i've created api with amplify add api, created lambda, created storage table in dynamo after i try to test GET endpoint in API gateway it gives me 404

To Reproduce Steps to reproduce the behavior: amplify add api, add storage, add lambda function

Expected behavior

i am able to test API gateway GET method from UI

Screenshots Screenshot 2020-04-29 at 15 04 51

cognito is set to currently accept unauthenticated calls

i've followed documentation to create api for react app, all seems to be set, i can see dynamo table arn in lambda also API gateway is properly configured.

but still i am not sure why i am getting this error? just wanted to see did anyone else experienced the same issue? thanks

bitlejac avatar Apr 29 '20 13:04 bitlejac

@bitlejac, looks like you are trying to test API gateway method you provisioned from Amplify CLI using AWS Console and it's giving you 404 errors.

I'm transferring this to amplify CLI repo which provisions your AWS resources and set everything up to look into this.

Amplifiyer avatar Apr 29 '20 22:04 Amplifiyer

@bitlejac Can you provide the steps you used to provision this resource?

ammarkarachi avatar Apr 30 '20 03:04 ammarkarachi

so here it is, steps first to add api, since i tried now to add new one:

Screenshot 2020-04-30 at 09 08 53 Screenshot 2020-04-30 at 09 09 31

and steps for provisioning : Screenshot 2020-04-30 at 09 07 17 Screenshot 2020-04-30 at 09 07 32

bitlejac avatar Apr 30 '20 07:04 bitlejac

@bitlejac If you take a look at the app.js file generated by the CRUD template, it expects the GET path to be /movers/moverId. The CRUD template comes with a lot of overhead that is primarily directed towards customers that are coming from AWS Mobile Hub. If you are trying to set up a new REST API, you will probably be better off starting from the "serverless" template instead

edwardfoyle avatar May 05 '20 22:05 edwardfoyle

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 26 '21 09:05 github-actions[bot]