Skip to content

AWS Gateway: API does not respond in Postman

0

VS2022, Lambda (NET6)

When I run locally my Lambda it wokrs fine https://localhost:8804/api/Supplier/GetTotal 1023 OK I have created AWS Gateway GET /GetTotal

then I send request to AWS https://******a8.execute-api.eu-west-2.amazonaws.com/GetTotal Received: error 404 May be the difference https://localhost:8804/**api/Supplier/GetTotal ?

What I did wrong?

asked 3 years ago1.2K views

2 Answers
0

404 is page not found. Is the uri correct? Is the gateway name host correct?

EXPERT

answered 3 years ago

0

It seems like the API Gateway is not properly set up or configured to route the requests to your Lambda function. The API Gateway serves as the front-door for applications to access data, business logic, or functionality from your backend services.

Route Configuration: The error you're seeing (404) suggests that AWS cannot find the route you're trying to access. The route in the API Gateway should mirror the route in your local setup. In your local environment, your route is /api/Supplier/GetTotal, but your AWS Gateway is set up with the route /GetTotal. These need to be the same. Try changing your API Gateway route to /api/Supplier/GetTotal.

Lambda Function Integration: After setting up the correct routing, you also need to ensure that the API Gateway is correctly integrated with your Lambda function. You need to create a GET method under your /api/Supplier/GetTotal resource and integrate it with the Lambda function. The AWS console provides an easy way to do this, or you can use the AWS CLI or SDKs.

API Deployment: Don't forget that after making changes to your API Gateway, you'll need to deploy the API for the changes to take effect. Until you deploy your API, the changes will not be live and accessible from the front end.

Lambda Permissions: Lastly, ensure your Lambda function has the necessary IAM permissions to be invoked by API Gateway. You need to add the lambda:InvokeFunction permission to your API Gateway role.

If you have followed all these steps and are still getting an error, the problem might be within the details of the configuration. In this case, reviewing your setup with AWS documentation or posting a detailed question in AWS support forums would be beneficial.

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.