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

fix(aws-lambda): FunctionUrl incorrectly uses Alias ARNs #21353

Merged
merged 1 commit into from
Jul 28, 2022

Conversation

RomainMuller
Copy link
Contributor

When configuring a FunctionUrl for a Lambda function Alias,
the underlying lambda function's ARN must be configured
as TargetFunctionArn, and the alias name as Qualifier. This
was previously not the case, as the Alias' ARN was used
with no qualifier, which accidentally succeeded provisionning
but did not necessarily produce the intended result.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

When configuring a FunctionUrl for a Lambda function Alias,
the underlying lambda function's ARN must be configured
as TargetFunctionArn, and the alias name as Qualifier. This
was previously not the case, as the Alias' ARN was used
with no qualifier, which accidentally succeeded provisionning
but did not necessarily produce the intended result.
@RomainMuller RomainMuller requested a review from a team July 28, 2022 10:45
@RomainMuller RomainMuller self-assigned this Jul 28, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jul 28, 2022
@gitpod-io
Copy link

gitpod-io bot commented Jul 28, 2022

@github-actions github-actions bot added the p2 label Jul 28, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team July 28, 2022 10:45
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 4b657f8
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Jul 28, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 2904d2a into main Jul 28, 2022
@mergify mergify bot deleted the rmuller/lambda-url-with-alias branch July 28, 2022 11:22
@jrobbins-LiveData
Copy link
Contributor

I just now tried out the new 2.34.0 release and unfortunately got an error:

HyphenBugStack | 5/8 | 2:31:25 PM | CREATE_IN_PROGRESS | AWS::Lambda::Url | HyphenBugLambda/AliasHYPHEN-BUG/FunctionUrl (HyphenBugLambdaAliasHYPHENBUGFunctionUrlB90B407E)
HyphenBugStack | 5/8 | 2:31:25 PM | CREATE_IN_PROGRESS | AWS::Lambda::Permission | HyphenBugLambda/AliasHYPHEN-BUG/invoke-function-url (HyphenBugLambdaAliasHYPHENBUGinvokefunctionurlCDA5BB7A) Resource creation Initiated
HyphenBugStack | 5/8 | 2:31:27 PM | CREATE_IN_PROGRESS | AWS::Lambda::Url | HyphenBugLambda/AliasHYPHEN-BUG/FunctionUrl (HyphenBugLambdaAliasHYPHENBUGFunctionUrlB90B407E) Resource creation Initiated
HyphenBugStack | 6/8 | 2:31:27 PM | CREATE_COMPLETE | AWS::Lambda::Url | HyphenBugLambda/AliasHYPHEN-BUG/FunctionUrl (HyphenBugLambdaAliasHYPHENBUGFunctionUrlB90B407E)
HyphenBugStack | 7/8 | 2:31:35 PM | CREATE_COMPLETE | AWS::Lambda::Permission | HyphenBugLambda/AliasHYPHEN-BUG/invoke-function-url (HyphenBugLambdaAliasHYPHENBUGinvokefunctionurlCDA5BB7A)
HyphenBugStack | 7/8 | 2:31:37 PM | ROLLBACK_IN_PROGRESS | AWS::CloudFormation::Stack | HyphenBugStack Unable to retrieve FunctionUrl attribute for AWS::Lambda::Url, with error message Internal error occurred.. Rollback requested by user.

My CDK project is here: https://github.com/LiveData-Inc/hyphen-bug

Here's a copy of the CDK output template.json in case it sheds any light on what went wrong.

HyphenBugStack.template - Copy.json.txt

@jrobbins-LiveData
Copy link
Contributor

A hyphen in the Alias Name seems to cause the problem. If I change the hyphen to an underscore, the stack deploys.

@RomainMuller
Copy link
Contributor Author

@jrobbins-LiveData the contents of your template is correct, and I believe this is a bug in the CloudFormation resource handler for AWS::Lambda::URL. We have already informed them about this.

@jrobbins-LiveData
Copy link
Contributor

@RomainMuller is there any way for us to know when the CloudFormation issue will be fixed?

josephedward pushed a commit to josephedward/aws-cdk that referenced this pull request Aug 30, 2022
When configuring a FunctionUrl for a Lambda function Alias,
the underlying lambda function's ARN must be configured
as TargetFunctionArn, and the alias name as Qualifier. This
was previously not the case, as the Alias' ARN was used
with no qualifier, which accidentally succeeded provisionning
but did not necessarily produce the intended result.


----

*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
contribution/core This is a PR that came from AWS. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants