Comments (6)
Hey @andreasgrimm @mattjennings I think this fix would close this issue. Feel free to reopen if you still encounter it
from serverless-esbuild.
https://github.com/serverless-heaven/serverless-webpack/pull/813/files
serverless-webpack
moved from bestzip
to nativeZip, nodeZip
because of the same error happing there.
Are you able to fix that in the same way?
Or would you be open to accept a PR?
from serverless-esbuild.
I'd like to suggest a workaround until the root cause is investigated/fixed. Since the issue seems to be because of the large number of files (externals), is deleting some of the unecessary files in node_modules
is an option for you? You can utilize a tool like clean-modules
or node-prune
to clean up before zipping/packaging.
You can achieve this with esbuild.packagerOptions.scripts
, here is an example. For more info about clean-modules
npm package, please check https://www.npmjs.com/package/clean-modules
packagerOptions:
scripts:
- npm install -g clean-modules
- clean-modules -y --exclude \"test.js\" \"**/*.map.js\" --include \"**/*.d.ts\"
from serverless-esbuild.
A coworker and I ran into this on the same monorepo project. Packaging worked for me, but didn't for them. Same node (14.17.3), yarn (1.18.0), npm (6.14.13) versions. I'm on macOS 11.4, they're on macOS 10.15.7.
I ended up making a patch for patch-package that changed the zip method to nodeZip. We tried nativeZip but it threw the same error.
Add this under patches/serverless-esbuild+1.16.1.patch
diff --git a/node_modules/serverless-esbuild/dist/utils.js b/node_modules/serverless-esbuild/dist/utils.js
index 2b0be27..580c65c 100644
--- a/node_modules/serverless-esbuild/dist/utils.js
+++ b/node_modules/serverless-esbuild/dist/utils.js
@@ -94,7 +94,7 @@ const humanSize = (size) => {
exports.humanSize = humanSize;
const zip = (zipPath, filesPathList, workingDir) => {
fs.mkdirpSync(path.dirname(zipPath));
- return bestzip_1.bestzip({
+ return bestzip_1.nodeZip({
source: filesPathList.map((file) => file.localPath),
destination: zipPath,
cwd: workingDir || process.cwd()
from serverless-esbuild.
Hey @andreasgrimm thanks for the issue, yes we're welcome to PRs. It would be good if provide a hint how to reproduce the issue. Unfortunately, I don't have such a big workload.
@mattjennings was the fix you made with patch-package
good enough to resolve the issue?
from serverless-esbuild.
@floydspace yeah we haven't had any issues since using it
from serverless-esbuild.
Related Issues (20)
- Bun support HOT 1
- Unable to serverless package when no lambdas exist HOT 3
- serverless deploy fails without a reason when using esbuild-plugin-tsc HOT 2
- Rewrite Module Packaging Logic HOT 3
- I'm not sure if it supports layers
- pnpm: external modules bundled without their nested modules. HOT 2
- Indirect dependency marked as external missing in package HOT 1
- Slow performance when using external property
- Esbuild cannot rebuild error
- `patterns` not respected at `invoke local`
- sls package fails with individually: true for specific function Error: ENOENT: no such file or directory, copyfile
- update esbuild peerDependency HOT 1
- Support ESBuild 0.20.0 HOT 2
- watch function work with serverless-localstack.
- Possible memory-use regression in v1.48.1 HOT 1
- Stuck on Need a faster logging experience when using serverless-stack with serverless-esbuild HOT 1
- Support Lambda custom runtimes HOT 2
- Trouble importing to esbuild.config.js from an internal monorepo package HOT 1
- Hangs indefinitely on esbuild error HOT 1
- Overriding the keyword used to get the handler in the lambda function defintion HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-esbuild.