AWS API Gateway SDK generation error at least one operation - amazon-web-services

I am trying to generate an SDK for am API Gateway that is already deployed and has 2 stages created in API Gateway console.
However, when I try to create an SDK from it using the API Gateway Console, I encounter the following error.
Generation failed during SETUP stage: Must have at least one operation present in the API
Has anyone encountered this error? I do not see any thing else on the AWS Console.

Try to add a GET method under /, and link it to mock integration should solve this issue.

Related

Deployment failing after deleting API Gateway. How to recover?

After I removed the API gateway manually via the aws console because changing the configuration in my serverless.yml file didn’t seem to change the Gateway configuration anymore.
Now deployment fails with " An error saying: ApiGatewayMethodGet - Template error: API Gateway RestAPI dj1ivqgipb doesn't exist".
I understand that this is an error caused by me, but can anyone please hint me into the direction of how to recover from this?
https://i.stack.imgur.com/rzr8S.png
All I did was to go to API Gateway -> Custom domain names -> then I reconfigure API mapping from pointing to the old deleted API to then point to the existing API that I just created in the cli... Then now I can re-deploy my serverless application.
https://i.stack.imgur.com/N6Sjh.png

AWS Lambda calling API gateway getting 500 internal server error

I'm developing several AWS serverless applications using Lambda and API gateway.
At one point, I tried to execute an API request on one application (using requests python lib) from code running inside a Lambda function in another application. I get 500 server error. From the logs it appears that the Lambda function behind the API gateway is not starting at all. I don't find any logs that can tell me what happened.
Additional details:
The API gateway is protected by IAM auth.
The calling lambda has permission to "execute_api"
The request is signed according to Signature V4 - I followed the example here: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html#sig-v4-examples-post .
The issue was that the calling lambda needed permission to execute the second lambda behind the API gateway. I don't know why that is. I also still don't know how I should have debugged this - where are the logs that should tell me what was the issue. Eventually it was a lucky guess on my side.

AWS throws An Unknown error occurred while deploying API Gateway

In AWS API Gateway I am trying to deploy API to new stage, and im getting error "An unknown error occurred". I am assuming it most likely because of permission. But i have API Gateway administrator permissions.
How do find out exactly which permissions are missing? Does aws api gateway logs any deployment related events? Where do i find whats going on.
Answering your question of Api Gateway deployment events, below are typical steps I do on what's happening.
Any operation you perform on Console or SDK is essentially calling AWS APIs.
For Console failures, you can always check on client side by going to Developer Tools provided by browsers. Typically F12 key --> Network tab, replicate the issue and see which AWS Endpoint gave error or go to Console tab and see any JavaScript errors logged.
If I am still not able to determine the cause, I enable CloudTrail logs and see which user and which API call gave any error responses for which operation. CloudTrail Guide to ApiGateway.
If there is specific role or policy issue having issue, I use Policy Simulator to test policies for the role once permissions are added.

Calling api gateway returns 403 and error about api key within CI but is fine outside of CI (Codebuild)

Using Cloudformation I have created an API Gateway and Usage Plan and then use the CLI/SDK to create an API Key. All this happens within our CI process. Then we test that the api returns the correct results (using dredd), however it fails with the following error:
API Key **********************************Rp9Mjh not authorized because method 'GET /bookings' requires API Key and API Key is not associated with a Usage Plan for API Stage XXXX/Prod: No Usage Plan found for key and API Stage
When I test the key outside of Codebuild (ie postman) it works fine.
Could somebody offer a suggestion of what could be wrong as I'm not sure why the exact same request fails from within Codebuild but runs fine outside.
Adding a sleep in the buildspec has fixed this. Apparently when api gateway generates the key its not available straight away.

AWS Mobile Hub will not allow me to import an existing API

So I am trying to integrate AWS lambda into my mobile application, and I have a working API that I created outside of AWS Mobile Hub. I try to import the API, but it does not update the SDK/Sample app. When I try and create an API through the Mobile Hub, the POST method returns an internal server error, even though I followed the same exact steps in creating this API. Does anyone know what is going on with this? It's very frustrating.
Sorry to hear you are experiencing some issues integrating Lambda with your mobile application. I have a few ideas for root causing this.
First, check the Lambda function can be called by your API by using the test feature in API Gateway. Find it by clicking on the API method in the API Gateway console.
If you see an error here it points to an issue with either (a) bad permissions: the API doesn't have permissions to invoke your Lambda function or (b) your Lambda function can't properly handle the request from your API.
If everything appears OK in the API Gateway console then try testing your API in the Mobile Hub console using the "Test API" button inside the Cloud Logic feature. An error here would indicate an issue with your response mapping or a permissions issue invoking the API outside the API Gateway console.