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

API Gateway proxy Lambda loses permissions when functionName is changed #5306

Closed
masse-solita opened this issue Dec 5, 2019 · 2 comments · Fixed by #8813
Closed

API Gateway proxy Lambda loses permissions when functionName is changed #5306

masse-solita opened this issue Dec 5, 2019 · 2 comments · Fixed by #8813
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway @aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. p1

Comments

@masse-solita
Copy link

Reproduction Steps

  1. Create an API Gateway RestAPI and a LambdaIntegration
  2. Deploy
  3. Change the Lambda's functionName property.
  4. Deploy

Error Log

API Gateway fails to invoke the function and reports:
Execution failed due to configuration error: Invalid permissions on Lambda function

Environment

  • CLI Version : 1.18.0 (build bc924bc)
  • Framework Version: 1.18.0
  • OS : Mac OSX
  • Language : TypeScript

Other


This is 🐛 Bug Report

@masse-solita masse-solita added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 5, 2019
@masse-solita masse-solita changed the title Changing the functionName of API Gateway proxy Lambda loses permissions. API Gateway proxy Lambda loses permissions when functionName is changed Dec 5, 2019
@SomayaB SomayaB added @aws-cdk/aws-apigateway Related to Amazon API Gateway @aws-cdk/aws-lambda Related to AWS Lambda labels Dec 5, 2019
@nija-at
Copy link
Contributor

nija-at commented Dec 7, 2019

Ack'ing this issue. Changing the function name in a API Gateway Lambda integration does break the integration.

Repro code -

import lambda = require('@aws-cdk/aws-lambda');
import apig = require('@aws-cdk/aws-apigateway');
import core = require('@aws-cdk/core');

const app = new core.App();
const stack = new core.Stack(app, 'mystack');

const handler = new lambda.Function(stack, 'myfunction', {
    functionName: 'myfunctionname-1',
    code: lambda.Code.fromAsset('resources'),
    runtime: lambda.Runtime.NODEJS_10_X,
    handler: 'index.handler'
});

const restapi = new apig.RestApi(stack, 'myrestapi');

restapi.root.addMethod('ANY', new apig.LambdaIntegration(handler));

@nija-at nija-at added p1 and removed needs-triage This issue or PR still needs to be triaged. labels Dec 7, 2019
@OG84
Copy link

OG84 commented Jun 6, 2020

Omg spent 2 days figuring out why i get an AuthorizerConfigurationException 500 response.
Until I found this issue 😄

nija-at pushed a commit that referenced this issue Jun 30, 2020
… name is modified

Changing function name triggers a resource replacement - the old
function is removed and replaced with a new function.
However, the RestApi deployment remains untouched and is still pointing
at the ARN of the, now stale, function.

The fix is to trigger a new deployment if the function name changes.

fixes #5306
nija-at pushed a commit that referenced this issue Jun 30, 2020
… name is modified

Changing function name triggers a resource replacement - the old
function is removed and replaced with a new function.
However, the RestApi deployment remains untouched and is still pointing
at the ARN of the, now stale, function.

The fix is to trigger a new deployment if the function name changes.

fixes #5306
@mergify mergify bot closed this as completed in #8813 Jul 2, 2020
mergify bot pushed a commit that referenced this issue Jul 2, 2020
… name is modified (#8813)

Changing function name triggers a resource replacement - the old
function is removed and replaced with a new function.
However, the RestApi deployment remains untouched and is still pointing
at the ARN of the, now stale, function.

The fix is to trigger a new deployment if the function name changes.

fixes #5306


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway @aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants