Skip to content
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

running demoparser in aws lambda (or: including binaries for another platform than current platform) #226

Open
danielfyhr opened this issue Oct 29, 2024 · 0 comments

Comments

@danielfyhr
Copy link

danielfyhr commented Oct 29, 2024

hi,

i want to run demoparser both locally and on aws Lambda, and I have a hacky solution. i'm wondering if it's possible to solve this in a more graceful manner.

current setup

  • local development: macos arm64 using @laihoe/demoparser2-darwin-arm64
  • aws lambda: linux arm64 requiring @laihoe/demoparser2-linux-arm64-gnu

current solution

to add the linux binary to my package.json from my mac, i have to run:

npm install @laihoe/demoparser2-linux-arm64-gnu --force

The --force flag is required to bypass this error:

53 verbose stack Error: Unsupported platform
53 verbose stack at checkPlatform (/Users/danielfy/.nvm/versions/node/v18.19.0/lib/node_modules/npm/node_modules/npm-install-checks/lib/index.js:55:25)
53 verbose stack at #checkEngineAndPlatform
...

then i use esbuild to copy .node files so my code package looks like this for the lambda function:

demoparser2.darwin-arm64-M4AIRYHZ.node
demoparser2.linux-arm64-gnu-SPGLXOPY.node
main.mjs

questions

  1. is there a way to handle this more elegantly? for example, other packages like ffmpeg-static handle multiple platforms seamlessly without requiring --force flags or platform-specific installations.
  2. is it possible to bundle multiple platform binaries in a single package?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant