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.putIntegration type for AWS Lambda #868

Closed
brianleroux opened this issue Jan 10, 2016 · 17 comments
Closed

apigateway.putIntegration type for AWS Lambda #868

brianleroux opened this issue Jan 10, 2016 · 17 comments

Comments

@brianleroux
Copy link

It appears that API Gateway does not currently allow to associate an Lambda to a an method request integration. (But maybe I'm just missing how to do it in the docs!)

@chrisradek
Copy link
Contributor

@brianleroux
You would want to include the Lambda function as part of the uri.
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}

See #769 for more discussion on the topic.

@brianleroux
Copy link
Author

awesome thx. (had figured this out after looking at swagger gen … docs could use some colour!)

@brianleroux
Copy link
Author

hmmm. still having troubles.

{ httpMethod: 'POST',
  resourceId: '6pfvuf',
  restApiId: 'afz6ejjune',
  uri: 'arn:aws.apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:455488262213:function:begin-account-api-invite',
  type: 'AWS',
  integrationHttpMethod: 'POST',
  credentials: 'smallwins-api-lambda' }

With the error:

{ [BadRequestException: Invalid ARN specified in the request]

But it looks good to me?

@brianleroux brianleroux reopened this Jan 13, 2016
@chrisradek
Copy link
Contributor

@brianleroux
I had a typo in my example, there should be a colon after the first aws in the arn, not a period. Please give that a try!

@brianleroux
Copy link
Author

jeez, I didn't even see that period. (must be getting late!) unfortunately still getting an error. these params:

{ httpMethod: 'POST',
  resourceId: 'dl5emh',
  restApiId: 'lko08s3rjb',
  uri: 'arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:455488262213:function:begin-account-api-register',
  type: 'AWS',
  integrationHttpMethod: 'POST',
  credentials: 'smallwins-api-lambda' }

get this:

[BadRequestException: Invalid ARN specified in the request]

😬

@chrisradek
Copy link
Contributor

@brianleroux
I suspect your credentials also need to be the full arn. I'll verify on my end if that's the case.

@chrisradek
Copy link
Contributor

@brianleroux
I ran a test on my end, and an ARN should be provided for credentials as well.
Let me know if you still see errors after changing that!

@brianleroux
Copy link
Author

Awesome! that (sort of) worked!

Wed Jan 13 23:26:16 UTC 2016 : Execution failed due to configuration error: API Gateway does not have permission to assume the provided role

guessing this means the thing in my credentials needs but struggling though that config (alas)

screen shot 2016-01-13 at 3 41 27 pm

screen shot 2016-01-13 at 3 41 36 pm

Kind of crazy. Appreciate your help!

@chrisradek
Copy link
Contributor

@brianleroux
Are you seeing that message as a result of running putIntegration, or from actually testing the method?

@brianleroux
Copy link
Author

result of actually testing (after editing the role tho / the putIntegration
works now w/ the role arn specified)

On Wed, Jan 13, 2016 at 4:10 PM, Christopher Radek <notifications@github.com

wrote:

@brianleroux https://github.com/brianleroux
Are you seeing that message as a result of running putIntegration, or
from actually testing the method?


Reply to this email directly or view it on GitHub
#868 (comment).

@brianleroux
Copy link
Author

Appears the error is role/policy related <AccessDeniedException> but I have it wiiiide open.

Thu Jan 14 01:05:46 UTC 2016 : Starting execution for request: test-invoke-request
Thu Jan 14 01:05:46 UTC 2016 : API Key: test-invoke-api-key
Thu Jan 14 01:05:46 UTC 2016 : Method request path: {}
Thu Jan 14 01:05:46 UTC 2016 : Method request query string: {}
Thu Jan 14 01:05:46 UTC 2016 : Method request headers: {}
Thu Jan 14 01:05:46 UTC 2016 : Method request body before transformations: null
Thu Jan 14 01:05:46 UTC 2016 : Endpoint request URI: https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-east-1:455488262213:function:begin-account-api-forgot
Thu Jan 14 01:05:46 UTC 2016 : Endpoint request headers: {Authorization=************************************************************************************************************************************************************************************************************************************************d0176d, X-Amz-Date=20160114T010546Z, Accept=application/json, User-Agent=AmazonAPIGateway_ys16lfz71c, X-Amz-Security-Token=AgoGb3JpZ2luECUaCXVzLWVhc3QtMSKAAixKX5B/DA2Ene3e/F20q8UOe9I9zxElqGKIU1AkW0EvfOMnZXtyuPdKuSd3pS7ww+6IiGh2jkgaizgzpXHHQZE9og6n2abNYo0TWM2/dKFigRiQLgMHS0rCCeXOAtFSqgsF3U52z10JM2ryGG4Xu9ACBE4wqmK8sUILJvCppwdtCJCGuaQRsh1jZHgnicj2hyPKZuz1HuWAtX/rxEL8YydIHcadn57LuGDXGCNnKUA302j0GY2Cc0lccDvlFpimIo2sGzphVObNg4mVbob0PdVGdo6YJJD//IzCkQnvX8an/S4kQFkigPJZmfjh6/ff+IjBDPsgDHHS7+GacSd45V0q/QEIOhAAGgw0NTU0ODgyNjIyMTMiDJpMEg5mPGsej0kZtiraAbNH1cjLxPO3qOY0H3ctZ8zRdQG38OJXY0+NDrqvkKtJMyZpSmxDeKwYXODiMN7CpNc8+AeX7uFCaXWz3IZSohevY8atUBUkqwAeUlbfL/fF2Jxt3kV+83aPXSgRwsjpzhUM/wHyJyJjzKyUXO5EZ9AYJMORmNLZq0BhWsz0KjKj/T7qUdI+LNyEwAdu/+BWsOb+ [TRUNCATED]
Thu Jan 14 01:05:46 UTC 2016 : Endpoint request body after transformations: 
{
  "body" : {},
  "headers": {
      },
  "method": "POST",
  "params": {
      },
  "query": {
      }  
}

Thu Jan 14 01:05:46 UTC 2016 : Endpoint response body before transformations: <AccessDeniedException>
  <Message>Unable to determine service/operation name to be authorized</Message>
</AccessDeniedException>

@brianleroux
Copy link
Author

For reference this is what I'm using in the putIntegration call:

{ type: 'AWS',
  httpMethod: 'POST',
  uri: 'arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:455488262213:function:begin-account-api-invite',
  credentials: 'arn:aws:iam::455488262213:role/smallwins-api-lambda'}

(again huge thx for your help in getting this working)

@chrisradek
Copy link
Contributor

@brianleroux
Have you taken a look at this forum post yet? There are some suggestions related to the errors you're seeing.
https://forums.aws.amazon.com/thread.jspa?threadID=220021

@chrisradek
Copy link
Contributor

@brianleroux
I'm going to close this issue since the original question is solved, and your errors appear to be related to policies and apigateway.
Feel free to comment or reopen if you're still having issues with putIntegration.

@brianleroux
Copy link
Author

👍

I'll be back…!

@loloDawit
Copy link

Screen Shot 2019-05-19 at 3 57 44 PM

I'm getting Invalid ARN specified in the request error. I'm following the API Gateway example. Not sure the source of the error. see attached screenshot.

@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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants