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(lambda): replace node 8 usages, allow node 10 inline assets #4655

Closed
wants to merge 17 commits into from

Conversation

nmussy
Copy link
Contributor

@nmussy nmussy commented Oct 23, 2019

  • set supportsInlineCode to true for Runtime.NODEJS_10_X
  • add Runtime.NODE_LATEST, currently aliasing Runtime.NODEJS_10_X
  • replace all usages of Node 8 and 10 with Runtime.NODE_LATEST

Fixes #4653
Fixes #4642

Before merging, aws-cloudformation-coverage-roadmap#80 is still "Coming soon", we need to wait for it to be implemented


Alternative: It might be more maintainable to add "latest/stable" runtimes instead, aliasing the preferred version (e.g. Runtime.NODE_STABLE pointing to NODE_10_X)


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

@mergify
Copy link
Contributor

mergify bot commented Oct 23, 2019

Thanks so much for taking the time to contribute to the AWS CDK ❤️

We will shortly assign someone to review this pull request and help get it
merged. In the meantime, please take a minute to make sure you follow this
checklist
:

  • PR title type(scope): text
    • type: fix, feat, refactor go into CHANGELOG, chore is hidden
    • scope: name of module without aws- or cdk- prefix or postfix (e.g. s3 instead of aws-s3-deployment)
    • text: use all lower-case, do not end with a period, do not include issue refs
  • PR Description
    • Rationale: describe rationale of change and approach taken
    • Issues: indicate issues fixed via: fixes #xxx or closes #xxx
    • Breaking?: last paragraph: BREAKING CHANGE: <describe what changed + link for details>
  • Testing
    • Unit test added. Prefer to add a new test rather than modify existing tests
    • CLI or init templates change? Re-run/add CLI integration tests
  • Documentation
    • README: update module README to describe new features
    • API docs: public APIs must be documented. Copy from official AWS docs when possible
    • Design: for significant features, follow design process

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@nmussy nmussy changed the title feat(lambda): node 10 inline support fix(lambda): replace node 8 usages, allow node 10 inline assets Oct 24, 2019
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

I like the NODE_LATEST idea. @nija-at @rix0rrr @RomainMuller what do you guys think?

packages/@aws-cdk/aws-lambda/lib/runtime.ts Show resolved Hide resolved
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@nmussy nmussy marked this pull request as ready for review October 26, 2019 13:41
@nmussy
Copy link
Contributor Author

nmussy commented Oct 26, 2019

Could a team member add a "do-not-merge" tag to this PR, waiting for aws-cloudformation-coverage-roadmap#80 to ship?

Thanks!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@skinny85 skinny85 added the pr/do-not-merge This PR should not be merged at this time. label Oct 28, 2019
@nija-at
Copy link
Contributor

nija-at commented Nov 13, 2019

It looks like CloudFormation now supports inline code for Nodejs10 Lambda functions (tried these out myself)

@nmussy
Copy link
Contributor Author

nmussy commented Nov 13, 2019

@nija-at Great, thanks for letting me know! I'll merge master and see if there are new usages, but this should be good to go

@nmussy
Copy link
Contributor Author

nmussy commented Nov 13, 2019

It should be good to go 👍

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@nija-at
Copy link
Contributor

nija-at commented Nov 14, 2019

I like the NODE_LATEST idea. @nija-at @rix0rrr @RomainMuller what do you guys think?

I have a couple of concerns around NODE_LATEST -

Firstly, does node guarantee that future proofing, i.e., all node8 scripts are valid node10, and so on? If not, we'll be breaking customers (at runtime which is worse) whenever we change NODE_LATEST.

Secondly, it is entirely within Lambda's contract and CloudFormation's contract to modify or stop supporting a feature that existed until one major version language to the next.

A good example is where, for a significant period of time, CloudFormation supported inline code for Node8 but not for Node10. If we had swiched NODE_LATEST during this time, we would have broken customers.

While this was a matter of time, I can other potential situations where such compatibility features and not available for a while; or upgrade is simply not possible without customers additional or modified attributes.

How do we handle such scenarios?

Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Code changes themselves look good to me.

  1. See my previous comment regarding NODE_LATEST.

  2. For all places in the CDK, where the CDK is shipping its own Lambda function as part of its construct and impacted by this change, could we run at least one integ test to deploy the stack to a real account and execute the function at least once for correctness of functionality?

@@ -75,7 +75,7 @@ const resource = new serverless.CfnFunction(this, 'Func', {
bucket: asset.s3BucketName,
key: asset.s3ObjectKey
},
runtime: 'nodejs8.10',
runtime: Runtime.NODEJS_LATEST,
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid changes to the design/ folder unless you're changing the design.

@nija-at
Copy link
Contributor

nija-at commented Nov 14, 2019

Thinking a bit more on the NODE_LATEST feature - this assumes latest === recommended which I'm not sure will stay true always.

Given these questions around this and the fact that Node8 is EOL in December (coming around the corner), I suggest we pull out the NODE_LATEST change from here and have that as a separate discussion. (the former would be a chore and the latter would be a feat so it's announced in our change log)

@nija-at
Copy link
Contributor

nija-at commented Nov 18, 2019

@nmussy - Given that Node8 deprecation is around the corner, I had to separate out the upgrade to Node10 from the NODE_LATEST changes.

I didn't have permissions to push on your branch (to update this PR) so I've pulled it out as a separate change #5075.
Apologies for the rush on this.

nija-at added a commit that referenced this pull request Nov 18, 2019
Upgrade all internal uses of node8.10 lambda runtime to node10.x.

This includes all exported constructs that contain a lambda function within them.

Update NODE_10_X runtime to allow inline code in CloudFormation, per
aws-cloudformation/cloudformation-coverage-roadmap#80.

Shout out to @nmussy who got this most of the way (#4655)

close #4653, close #4642
@nija-at
Copy link
Contributor

nija-at commented Nov 21, 2019

I got the upgrade to Node10 in through another PR - #5075

I'll be closing out on this one. Feel free to open another one if you want to discuss the NODE_LATEST feature but before that, do look at the questions raised in this PR.

@nija-at nija-at closed this Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/do-not-merge This PR should not be merged at this time.
Projects
None yet
6 participants