Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIGateway Put Integration still yields an error after update #769

Closed
stephenthedev opened this issue Oct 30, 2015 · 6 comments
Closed

APIGateway Put Integration still yields an error after update #769

stephenthedev opened this issue Oct 30, 2015 · 6 comments
Labels
documentation This is a problem with documentation. guidance Question that needs advice or information.

Comments

@stephenthedev
Copy link

Hello!

{ [BadRequestException: Enumeration value for HttpMethod must be non-empty]
  message: 'Enumeration value for HttpMethod must be non-empty',
  code: 'BadRequestException',
  time: Fri Oct 30 2015 05:36:49 GMT-0400 (EDT),
  statusCode: 400,
  retryable: false,
  retryDelay: 30 } null

aws/aws-cli#1605
boto/botocore#706

The above references a fix for the above message, but it still is not working. The above issue was closed, so created this one specifically in reference to the SDK. Version used to reproduce is: 2.2.13

Example code to reproduce:

gate.putIntegration({
     httpMethod:'POST', 
     resourceId: '8oqq0x', 
     restApiId: 'r3wraomlb6', 
     type: 'AWS'
}, console.log);
@chrisradek
Copy link
Contributor

@raghunat
I know the documentation isn't very clear on this, but you're missing a few more parameters for the putIntegration method.
When you're specifying type: 'AWS', you also need to provide the integrationHttpMethod, the uri, and the credentials (execution role).
Before the fix referenced above was made, it wasn't possible to set the integrationHttpMethod.

The uri is probably the trickiest parameter to specify the first time around. There's clearer documentation on how to build the uri on the API Gateway docs here:
http://docs.aws.amazon.com/apigateway/api-reference/resource/integration/#uri

So, if you wanted to call a lambda function, the uri would look something like this:
arn:aws.apigateway:{region}:lambda:path/2015-03-31/functions/{lambda function arn}

Let me know if this helps, or if you need further clarification.

@chrisradek chrisradek added Question documentation This is a problem with documentation. labels Oct 30, 2015
@stephenthedev
Copy link
Author

@chrisradek

Thanks for the response! Yes the documentation then was very unclear :-)

Would it then be something like this?

gate.putIntegration({
     httpMethod:'POST', 
     resourceId: '8oqq0x', 
     restApiId: 'r3wraomlb6', 
     type: 'AWS',
     integrationHttpMethod: 'POST',
     uri: 'arn:aws.apigateway:us-east-1:lambda:path/2015-03-31/functions/myFunctionName',
     credentials: 'myFullyQualifiedLambdaRole'
}, console.log);

@chrisradek
Copy link
Contributor

@raghunat
Yes, those parameters look correct. Just remember that in the uri, replace 'myFunctionName' with the full arn for your lambda function.

Let me know if that works, or if you're still having problems getting it to work.

@chrisradek
Copy link
Contributor

I'm closing this issue, but feel free to comment here or re-open if you're still having issues.

@billyjf
Copy link

billyjf commented Jan 3, 2017

The following line from the serverless application model examples helped me resolve this same issue, the uri is pretty tricky:

https://github.com/awslabs/serverless-application-model/blob/master/examples/2016-10-31/api_swagger_cors/swagger.yaml#L23

@srchase srchase added guidance Question that needs advice or information. and removed Question labels Jan 4, 2019
@lock
Copy link

lock bot commented Sep 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation This is a problem with documentation. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

4 participants