-
Notifications
You must be signed in to change notification settings - Fork 165
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
NPM package is too large for AWS Lambda #999
Comments
@claytondus - I like prebuildify+node-gyp-build but agree the size of a package can be an issue. possible approach (?)"optionalDependencies" with "postinstall" fallback script to install https://sentry.engineering/blog/publishing-binaries-on-npm Actual node bindings shouldn't be an issue I reckon
I'm trying to figure out if this is a viable solution long term any feedback appreciated. @mapnik/node-mapnik |
@artemp Thanks, yes this approach is acceptable to me. The size of the mapnik libraries themselves is the critical factor. |
@claytondus This is all very much [WIP] and needs more work. Could you try and let me know if this solves package size issue on Lambda.
On macOS arm64 I get -
On Linux x86_64
|
@artemp I was able to duplicate your results, and yes the install size is below the 250MB threshold (if I delete the prebuilds in @mapnik/mapnik). However, when adding this package as an override, node-gyp-build is being called: package.json
npm install (npm 10.8.2, node 20.17.0, darwin arm64)
|
@claytondus thanks for testing!
and post output either here or as a gist if too large. Also, could you try installing core package only with
? I'm wondering if preinstall script is not running or failing for some reason, thanks. |
@artemp The commands you gave installed successfully. I was only able to replicate my issue when using overrides in the package.json I posted above. When running npm install --foreground-scripts --loglevel=verbose with my package.json, it looks like the preinstall script is still looking for the prebuild:
|
@claytondus ok, thanks for feedback. I'll try to replicate this issue locally. |
@claytondus - I see the issue -> "overrides" strips
|
@mapnik/mapnik@4.6.4-experimental @claytondus should work, tested with -
|
@artemp Thanks, 4.6.4-experimental installed cleanly. I'm having some trouble with esbuild and the new package, but that is probably related to @mapbox/spritezero. It is working in my app without a bundler, so I likely just need to tune esbuild to bundle mapnik correctly with the override. |
Adding all three architectures' binary assets to a single package exceeds the 256 MB maximum for AWS Lambda. I realize I could create a Docker image but I would prefer to keep using Serverless. Is there a way to distribute a split package with optional dependencies restricted to the OS and architecture, like sharp?
The text was updated successfully, but these errors were encountered: