Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
Are you using the latest version of sharp?
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?
Please replace this section with the output of:
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
Does this problem relate to file caching?
Does this problem relate to images appearing to have been rotated by 90 degrees?
What are the steps to reproduce?
- Create a Next.js 16.2.10 application.
- Deploy it to Vercel.
- Install
sharp@0.35.3.
- Create a Server Action that imports
sharp and processes an uploaded image.
- Execute the Server Action.
The application builds and deploys successfully.
The error only occurs when the Server Action is executed.
Downgrading to sharp@0.34.4 without changing any application code makes the problem disappear.
What is the expected behaviour?
sharp should load successfully and process the image during execution of the Server Action.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
"use server";
import sharp from "sharp";
export async function convert(file: File) {
const buffer = Buffer.from(await file.arrayBuffer());
return await sharp(buffer)
.webp({ quality: 80 })
.toBuffer();
}
At runtime, Vercel throws:
Error: Failed to load external module sharp-xxxxxxxx
Could not load the "sharp" module using the linux-x64 runtime
ERR_DLOPEN_FAILED:
libvips-cpp.so.8.18.3: cannot open shared object file: No such file or directory
Stack trace includes:
.next/server/chunks/ssr/[turbopack]_runtime.js
Additional information:
- Next.js 16.2.10
- Vercel
- Turbopack
- pnpm 11.9.0
- Linux x64 runtime
@img/sharp-linux-x64 is installed successfully during deployment
- The application builds successfully
- The failure occurs only at runtime
- Downgrading to
sharp@0.34.4 resolves the issue immediately
I'm not yet sure whether this is a regression in sharp 0.35.x or an incompatibility with the current Next.js/Vercel packaging. I'm happy to provide a minimal reproduction repository if needed.
Please provide sample image(s) that help explain this problem
The issue is independent of the input image. Any valid JPEG image reproduces the problem.
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharpcompletes without error.node -e "import 'sharp'"completes without error.Are you using the latest version of sharp?
sharpas reported bynpm view sharp dist-tags.latest.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?Does this problem relate to file caching?
sharp.cache(false)does not fix this problem.Does this problem relate to images appearing to have been rotated by 90 degrees?
rotate()orkeepExif()does not fix this problem.What are the steps to reproduce?
sharp@0.35.3.sharpand processes an uploaded image.The application builds and deploys successfully.
The error only occurs when the Server Action is executed.
Downgrading to
sharp@0.34.4without changing any application code makes the problem disappear.What is the expected behaviour?
sharpshould load successfully and process the image during execution of the Server Action.Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
At runtime, Vercel throws:
Stack trace includes:
Additional information:
@img/sharp-linux-x64is installed successfully during deploymentsharp@0.34.4resolves the issue immediatelyI'm not yet sure whether this is a regression in
sharp0.35.x or an incompatibility with the current Next.js/Vercel packaging. I'm happy to provide a minimal reproduction repository if needed.Please provide sample image(s) that help explain this problem
The issue is independent of the input image. Any valid JPEG image reproduces the problem.