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
Optimize custom resources generation #7032
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @medikoo 👍
I like the idea of having a cache. However I'm concerned about npm versioning. What if AWS fixed a bug in their SDK and published a new version? In that case we would also need to publish a new Serverless Framework version to "invalidate" the cache.
I know that this might be an edge case we don't focus on. Just wanted to point this out...
It won't be the case, as when SLS version changes, it'll start caching to different path (note |
Codecov Report
@@ Coverage Diff @@
## master #7032 +/- ##
==========================================
- Coverage 88.5% 88.49% -0.01%
==========================================
Files 229 230 +1
Lines 8428 8447 +19
==========================================
+ Hits 7459 7475 +16
- Misses 969 972 +3
Continue to review full report at Codecov.
|
Yes, exactly. However what about the following (artificially made-up) example:
This might be a very rare circumstance we can ignore (or I'm missing something here). As the saying goes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it with the following serverless.yml
file and it works as expected!
service: test-${self:custom.idx}
provider:
name: aws
runtime: nodejs10.x
versionFunctions: false
region: eu-central-1
stage: dev
custom:
idx: 0
functions:
hello:
handler: functions/handler.handler
events:
- eventBridge:
pattern:
source:
- aws.cloudformation
detail-type:
- AWS API Call via CloudTrail
detail:
eventSource:
- cloudformation.amazonaws.com
Technically we're already immune to that issue. As currently also without bumping a framework version, it's very hard for users to upgrade So I guess, either with this caching or not, it's only the new patch release that makes a solid fix for users. |
I've also confirmed by running all integration tests (and picked one issue, which is already fixed in PR) |
This should partially address custom resource installation efficiency issues, as discussed recently on slack.
It ensures that custom resource package is prepared once for installed Serverless versions, and in further runs existing package is re-used.