too_easy
too_easy3w ago

Could not load the "sharp" module using the linux-arm64 runtime

Trying to use a library that uses sharp inside a convex action and get this error. Using bun pkg manager. Any thoughts from anyone?
4 Replies
Convex Bot
Convex Bot3w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
sonandmjy
sonandmjy3w ago
I’ve tried it with npm before and it works but i believe u have to use the node runtime and u have to externalise the module node runtime https://docs.convex.dev/functions/runtimes externalise https://docs.convex.dev/functions/bundling#external-packages
Runtimes | Convex Developer Hub
Convex functions can run in two runtimes:
Bundling | Convex Developer Hub
Bundling is the process of gathering, optimizing and transpiling the JS/TS
ballingt
ballingt3w ago
Yeah try this with the node runtime and "externalizing" the package with a convex.config like
{
"node": {
"externalPackages": ["aws-sdk", "sharp"]
}
}
{
"node": {
"externalPackages": ["aws-sdk", "sharp"]
}
}
if that doesn't work would be curious to hear, we know it works with npm and pnpm but it's possible there's more work to do for bun.
too_easy
too_easyOP2w ago
Yep love this! 👌 works like a charm. Works fine with bun

Did you find this page helpful?