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(apigateway): permission error in lambda integration when function name is modified #8813

Merged
merged 6 commits into from Jul 2, 2020

Conversation

@nija-at
Copy link
Contributor

nija-at commented Jun 30, 2020

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

… 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 nija-at self-assigned this Jun 30, 2020
@nija-at nija-at requested a review from aws/aws-cdk-team Jun 30, 2020
@mergify mergify bot added the contribution/core label Jun 30, 2020
nija-at added a commit that referenced this pull request Jun 30, 2020
Currently, the Method construct reaches into the internals of the
Integration class to construct itself, via the _props() internal method.

Change to a more recent pattern where the bind() returns a result that
contains all of the information that the Method class requires to
finalize the bind.

Motivation for the change
This change - #8813 - requires a
property returned to the Method that is not user specified. The change
already introduces this pattern. This PR takes it a bit further and
applies the same logic to existing properties, so that there is now only
one way for the Method to get the result of the bind.
@nija-at nija-at requested a review from eladb Jun 30, 2020
* This value is included in computing the Deployment's fingerprint. When the fingerprint
* changes a new deployment is triggered.
* This property should carry a different value when the Deployment needs to be refreshed.
* @default - deployments are not triggered for any change of this integration.

This comment has been minimized.

Copy link
@eladb

eladb Jun 30, 2020

Contributor

Add a note that it can be an arbitrary string and does not have to be a hash.

This comment has been minimized.

Copy link
@nija-at

nija-at Jul 1, 2020

Author Contributor

Switched to index type <string, string> so the user doesn't have to do JSON.stringify() unless they're adding a nested struct. The input to the hash gen will also be a bit nicer without the serialized objects.

@nija-at nija-at requested review from eladb and aws/aws-cdk-team Jul 1, 2020
@nija-at nija-at requested a review from eladb Jul 1, 2020
@eladb
eladb approved these changes Jul 1, 2020
@mergify
Copy link
Contributor

mergify bot commented Jul 1, 2020

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

@nija-at nija-at removed the pr/do-not-merge label Jul 1, 2020
@eladb
eladb approved these changes Jul 1, 2020
@mergify
Copy link
Contributor

mergify bot commented Jul 1, 2020

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

…loyment
@aws-cdk-automation
Copy link
Collaborator

aws-cdk-automation commented Jul 2, 2020

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 00eca44
  • 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 2, 2020

Thank you for contributing! Your pull request will be updated from master 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 f1b37ef into master Jul 2, 2020
7 of 8 checks passed
7 of 8 checks passed
build
Details
mandatory-changes
Details
Rule: automatic merge #1 (delete_head_branch) The rule doesn't match anymore
Details
AWS CodeBuild us-east-1 (AutoBuildProject6AEA49D1-qxepHUsryhcu) Build succeeded for project AutoBuildProject6AEA49D1-qxepHUsryhcu
Details
Gitpod Open an online workspace in Gitpod
Details
Rule: automatic merge #1 (merge) The pull request has been merged automatically
Details
Semantic Pull Request ready to be squashed
Details
Summary 1 rule matches and 4 potential rules
Details
@mergify mergify bot deleted the nija-at/apigateway-functionName-triggerDeployment branch Jul 2, 2020
mergify bot pushed a commit that referenced this pull request Jul 2, 2020
Currently, the Method construct reaches into the internals of the
Integration class to construct itself, via the _props() internal method.

Change to a more recent pattern where the bind() returns a result that
contains all of the information that the Method class requires to
finalize the bind.

Motivation for the change
This change - #8813 - requires a
property returned to the Method that is not user specified. The change
already introduces this pattern. This PR takes it a bit further and
applies the same logic to existing properties, so that there is now only
one way for the Method to get the result of the bind.


----

*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 pull request 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 pull request Jul 11, 2020
Currently, the Method construct reaches into the internals of the
Integration class to construct itself, via the _props() internal method.

Change to a more recent pattern where the bind() returns a result that
contains all of the information that the Method class requires to
finalize the bind.

Motivation for the change
This change - aws#8813 - requires a
property returned to the Method that is not user specified. The change
already introduces this pattern. This PR takes it a bit further and
applies the same logic to existing properties, so that there is now only
one way for the Method to get the result of the bind.


----

*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 pull request 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 pull request Jul 11, 2020
Currently, the Method construct reaches into the internals of the
Integration class to construct itself, via the _props() internal method.

Change to a more recent pattern where the bind() returns a result that
contains all of the information that the Method class requires to
finalize the bind.

Motivation for the change
This change - aws#8813 - requires a
property returned to the Method that is not user specified. The change
already introduces this pattern. This PR takes it a bit further and
applies the same logic to existing properties, so that there is now only
one way for the Method to get the result of the bind.

----

*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 pull request 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 pull request Jul 11, 2020
Currently, the Method construct reaches into the internals of the
Integration class to construct itself, via the _props() internal method.

Change to a more recent pattern where the bind() returns a result that
contains all of the information that the Method class requires to
finalize the bind.

Motivation for the change
This change - aws#8813 - requires a
property returned to the Method that is not user specified. The change
already introduces this pattern. This PR takes it a bit further and
applies the same logic to existing properties, so that there is now only
one way for the Method to get the result of the bind.

----

*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 issues

Successfully merging this pull request may close these issues.

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