-
Notifications
You must be signed in to change notification settings - Fork 87
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 incompatibility of node versions 15.5+ and serverless-artillery causing "Empty lambda zip" errors in load tests #856
Fix incompatibility of node versions 15.5+ and serverless-artillery causing "Empty lambda zip" errors in load tests #856
Conversation
console.info('Serverless Artillery stack is already deployed. Skipping redeployment.') | ||
return | ||
} | ||
console.info(`Serverless Artillery stack is in a wrong state: ${slsartStack?.StackStatus}. Redeploying.`) |
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 enhanced the check we were doing to see if we need to redeploy the serverless-artillery
stack
@@ -59,6 +59,7 @@ | |||
"lint:fix": "eslint --quiet --fix --ext '.js,.ts' **/*.ts", | |||
"compile": "ttsc -b tsconfig.json", | |||
"clean": "rimraf ./dist tsconfig.tsbuildinfo", | |||
"postinstall": "rimraf ../../node_modules/serverless/node_modules/archiver && echo 'Deleted buggy \"archiver\" module from \"serveless\" dependencies to use the newer hoisted one'", |
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.
This is the main change in this PR
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.
Nice one! Thanks :D
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.
Amazing 🙌
c9b027b
to
3043f07
Compare
Description
This is a "dependency-hell" chained error:
.end
onzlib.DeflateRaw
was changedarchiver
to fail. Only the newest version has it fixed..zip
were empty. We fixed this by updating the AWS CDK that used a newer version ofarchiver
serverless-artillery
usesserverless
to deploy the lambda that executes de load test.serverless
, in turn, usesarchiver
to zip the lambda's code. This means that we were getting the "empty lambda zip" error when deploying serverless-artillery for the load tests.serverless
uses the fixed version ofarchiver
, but we can't use it because it is incompatible with the version we are using ofserverless-artillery
.serverless-artillery
because there is not newer versionChanges
The solution is to force the version of
serverless
we are using (that's compatible withserverless-artillery
) to use a newer version ofarchiver
.The official way to do this (which is called "override dependencies") has still not reached the official version of node and NPM (official issue here)
The "un-official" way to do this is what is done in this PR:
node_modules
folder (instead of inside each package)archiver
is located at<root>/node_modules/archiver
serverless
is using, is located in a transitive dependency in<root>/node_modules/serverless/node_modules/archiver
serverless
module looks forarchiver
and it doesn't find it in its local "node_modules" folder, it will search for it in the parent directory (this is how every node module lookup is done), finding the goodarchiver
Checks
[ ] Updated documentation accordinglyAdditional information