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
Closed

Comments

@masse-solita
Copy link

@masse-solita masse-solita commented Dec 5, 2019

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 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
@nija-at
Copy link
Contributor

@nija-at 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 labels Dec 7, 2019
@OG84
Copy link

@OG84 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 added 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 added 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 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*
shearn89 added a commit to shearn89/aws-cdk that referenced this issue Jul 11, 2020
… name is modified (aws#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 aws#5306


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
shearn89 added a commit to shearn89/aws-cdk that referenced this issue Jul 11, 2020
… name is modified (aws#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 aws#5306

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
shearn89 added a commit to shearn89/aws-cdk that referenced this issue Jul 11, 2020
… name is modified (aws#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 aws#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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.