This repository has been archived by the owner on Sep 24, 2022. It is now read-only.
[showcase] Investigating max-old-space-size
settings
#1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is to showcase the oddity when we set max-old-space-size for Node, via
NODE_OPTIONS
, when runningsls
commands.Mainly, when using the installed
sls
standalone binary (via ServerlessFramework orb), we see an odd exit code 4, with this stacktace:Looking at that stacktrace, it seems to be a
pkg
issue.From what I can gather, the
sls
binary installed by CircleCI's ServerlessFramework is done as a standalone binary.From existing GitHub issues, there seem to be unresolved cases of
pkg
exiting on exit code 4.In particularly, this comment from a GitHub user seems to explain the situation, but not the solution:
vercel/pkg#921 (comment)
Solution
Hence, I provided an alternative to deploying, should you need to explicitly set max-old-space-size when deploying with
sls
.The solution is basically to forgo the
sls
standalone binary for now (i.e., not using the ServerlessFramework orb), and explicitly install the ServerlessFramework CLI via NPM and AWS CLI instead.You can see the differences in this PR's CI build status:
main
serverless-deploy-1
NODE_OPTIONS:--max-old-space-size=4096
, use ServerlessFramework Orbalternative
serverless-deploy-2
NODE_OPTIONS:--max-old-space-size=4096
, install ServerlessFramework CLI ourselves