Runtime error when importing `sharp` (pnpm / Vite+Nitro / TSS)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 365
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 169
Description
Title
Workflow runtime fails to load sharp while equivalent regular server path works (pnpm / Vite + Nitro / TanStack Start)
Repro
https://tss-workflow-sharp-bug.vercel.app/
Source code: https://github.com/TmLev/tss-workflow-sharp-bug
Summary
In the same app, sharp works in a regular server function but fails in a Workflow step at runtime.
- workflow path:
start(sharpWorkflow)("use workflow" + "use step") - regular path: same resize logic, no workflow directives
Expected
Both paths should return a successful resize result.
Actual
Regular path works, workflow path crashes indefinitely until stopped manually with:
2026-02-11 12:32:22.967 [error] Error: Could not load the "sharp" module using the linux-arm64 runtime
Possible solutions:
- Ensure optional dependencies can be installed:
npm install --include=optional sharp
- Ensure your package manager supports multi-platform installation:
See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
npm install --os=linux --cpu=arm64 sharp
- Consult the installation documentation:
See https://sharp.pixelplumbing.com/install
at node_modules/.pnpm/sharp@0.34.5/node_modules/sharp/lib/sharp.js (/var/task/index.js:2140:13)
at __require (/var/task/index.js:13:50)
at node_modules/.pnpm/sharp@0.34.5/node_modules/sharp/lib/constructor.js (/var/task/index.js:2152:5)
at __require (/var/task/index.js:13:50)
at node_modules/.pnpm/sharp@0.34.5/node_modules/sharp/lib/index.js (/var/task/index.js:7876:17)
at __require (/var/task/index.js:13:50)
at Object.<anonymous> (/var/task/index.js:30348:28)
at Module.<anonymous> (/opt/rust/bytecode.js:2:1435)
at A.d._compile (/opt/rust/bytecode.js:2:3186)
at Object..js (node:internal/modules/cjs/loader:1839:10)
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.
(Full logs are in the repo README)
Notes
- I understand TanStack Start is not officially supported yet, but there is an open PR/discussion acknowledging it is a wrapper around Vite+Nitro (which are supported): https://github.com/vercel/workflow/pull/877
- In this repro, Vercel build is
linux-x64and Workflow runtime islinux-arm64; despite that, regular sharp still works. - In my production project (Pro plan), builds are
linux-x64(GitHub Actions) and Workflow runtime is alsolinux-x64(matching arch), and I still hit the workflow-specific failure pattern.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction repository and its README, then compare the regular server path with the start(sharpWorkflow) workflow path. Use the deployment logs to investigate the runtime module-loading failure and verify the result on the reported architectures. Done means both paths complete the resize successfully without the workflow crashing indefinitely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100