Skip to content

Runtime error when importing sharp (pnpm / Vite+Nitro / TSS) #1003

Description

@TmLev

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): feat: add tanstack support #877
  • In this repro, Vercel build is linux-x64 and Workflow runtime is linux-arm64; despite that, regular sharp still works.
  • In my production project (Pro plan), builds are linux-x64 (GitHub Actions) and Workflow runtime is also linux-x64 (matching arch), and I still hit the workflow-specific failure pattern.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions