I have two Next.js projects that directly use sharp in API routes (not the separate handler for image optimization) and so far have failed to get it working.
The deployment works, but the module can't be found when I invoke these routes that use sharp.
Locally I'm on Darwin/arm64, use pnpm and the latest sharp 0.33.4.
Manually installing all @img/sharp linux platform packages that seemed like they could be relevant
Separately installing sharp from within my CI:
npm_config_arch=x64 npm_config_platform=linux pnpm add sharp
Not sure if the syntax is functional for pnpm since I only found examples for npm and tried to adapt that. Also I'm unsure if it would do anything additionall that what I had covered by manually installing all the sharp packages before.
Im unsure wether this belongs here or in https://github.com/sst/open-next.
I have two Next.js projects that directly use sharp in API routes (not the separate handler for image optimization) and so far have failed to get it working. The deployment works, but the module can't be found when I invoke these routes that use sharp. Locally I'm on Darwin/arm64, use pnpm and the latest sharp 0.33.4.
So far I have tried:
Adding supportedArchitectures to my package.json:
Manually installing all
@img/sharp
linux platform packages that seemed like they could be relevantSeparately installing sharp from within my CI:
npm_config_arch=x64 npm_config_platform=linux pnpm add sharp
Not sure if the syntax is functional for pnpm since I only found examples for npm and tried to adapt that. Also I'm unsure if it would do anything additionall that what I had covered by manually installing all the sharp packages before.Adding sharp in:
altough Im a bit unclear how this is resolved / what exactly it does
I'm wondering if the ion or open-next internal logic for sharp might somehow prevent sharp from being bundled properly.