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

chore(lambda): resolve unable to reference AuthType from FunctionUrl #31590

Merged
merged 7 commits into from
Oct 3, 2024

Conversation

watany-dev
Copy link
Contributor

@watany-dev watany-dev commented Sep 28, 2024

Reason for this change

I will resolve this issue: #31339 (comment). In the current FunctionURL implementation, there is no way to access AuthType, and therefore, when writing logic that depends on AuthType, there is no method to reference it.

Description of changes

I will fix the construct to allow access to functionurl.AuthType

Description of how you validated changes

adding unittest and integ-test re-run.

Reason for Exemption:

The fix introduces no changes to the resources being created.

Clarification Request:

This fix only makes the internal property authType of the L2 Construct publicly accessible, and does not introduce any differences in the created resources.

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team September 28, 2024 12:28
@github-actions github-actions bot added p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Sep 28, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@watany-dev watany-dev changed the title fix(lambda): Resolve unable to reference AuthType from FunctionUrl chore(lambda): resolve unable to reference AuthType from FunctionUrl Sep 28, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review September 28, 2024 12:50

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 28, 2024
Copy link
Contributor

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR! I've added only a small comment.

Comment on lines 239 to 243
if (fnUrl.authType === lambda.FunctionUrlAuthType.NONE) {
; // ok
} else {
throw new Error('AuthType must be NONE');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to use jest expect().

Suggested change
if (fnUrl.authType === lambda.FunctionUrlAuthType.NONE) {
; // ok
} else {
throw new Error('AuthType must be NONE');
}
expect(fnUrl.authType).toBe(lambda.FunctionUrlAuthType.NONE);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Also, I believe this PR should be a fix not a chore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is no change in the resource being created, I don't think this fix needs an integ test, but if the maintainer thinks it does, I'll change it to a fix.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 30, 2024
Copy link
Contributor

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Sep 30, 2024
@godwingrs22 godwingrs22 self-assigned this Oct 2, 2024
Copy link
Member

@godwingrs22 godwingrs22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @watany-dev for the contribution. Overall LGTM.

Just to make sure this change doesn't break anything, could you please rerun the existing integ test and try to deploy the stack manually and make sure the template is deploying successfully. Also validate if there is any change in the snapshot required. I hope it doesn't.

@watany-dev watany-dev changed the title chore(lambda): resolve unable to reference AuthType from FunctionUrl fix(lambda): resolve unable to reference AuthType from FunctionUrl Oct 3, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@watany-dev watany-dev changed the title fix(lambda): resolve unable to reference AuthType from FunctionUrl chore(lambda): resolve unable to reference AuthType from FunctionUrl Oct 3, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review October 3, 2024 15:18

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@watany-dev
Copy link
Contributor Author

I reran the integration test and confirmed it was successful. Since the test contents haven't changed, I reverted the fix back to chore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the difference in this feature_flag file is shown here. Could we remove this as i hope it is not related to this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry. reverted.

@godwingrs22
Copy link
Member

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

Please add a comment to request for exemption of integ test with justification.

@aws-cdk-automation aws-cdk-automation added pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Oct 3, 2024
@godwingrs22
Copy link
Member

godwingrs22 commented Oct 3, 2024

I reran the integration test and confirmed it was successful. Since the test contents haven't changed, I reverted the fix back to chore.

Thanks for confirming. Also please update in the Description of how you validated changes section about the testing of integration test you performed.

@watany-dev
Copy link
Contributor Author

watany-dev commented Oct 3, 2024

@godwingrs22
Thanks for the prompt review. Is this latest text ok?
#31590 (comment)

Copy link
Member

@godwingrs22 godwingrs22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @watany-dev for the contribution.

@godwingrs22 godwingrs22 added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Oct 3, 2024
Copy link
Contributor

mergify bot commented Oct 3, 2024

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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit b9e7855 into aws:main Oct 3, 2024
9 checks passed
Copy link
Contributor

mergify bot commented Oct 3, 2024

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).

Copy link

github-actions bot commented Oct 3, 2024

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants