Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vercel Sharp #9592

Closed
1 task
ohrrkan opened this issue Jan 3, 2024 · 5 comments
Closed
1 task

Vercel Sharp #9592

ohrrkan opened this issue Jan 3, 2024 · 5 comments
Labels
needs repro Issue needs a reproduction

Comments

@ohrrkan
Copy link

ohrrkan commented Jan 3, 2024

Astro Info

KO : "astro": "4.0.8", "astro": "4.0.9". 
Ok : "astro": "4.0.7",


both with "@astrojs/vercel": "6.1.2",

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

built-in <Image /> are no more correctly generated by sharp when build with Vercel integration.

installing sharp module do not solve it.

astro build give this new compilation warning :

[@astrojs/vercel] The module "@img/sharp-wasm32/versions" inside the file "/node_modules/sharp/lib/utility.js" couldn't be resolved. This may not be a problem, but it's worth checking.
[@astrojs/vercel] The module "@img/sharp-libvips-/package" inside the file "/node_modules/sharp/lib/sharp.js" couldn't be resolved. This may not be a problem, but it's worth checking.
[@astrojs/vercel] The module "@img/sharp-libvips-dev/include" inside the file "/node_modules/sharp/lib/libvips.js" couldn't be resolved. This may not be a problem, but it's worth checking.
[@astrojs/vercel] The module "@img/sharp-libvips-dev/cplusplus" inside the file "/node_modules/sharp/lib/libvips.js" couldn't be resolved. This may not be a problem, but it's worth checking.

What's the expected result?

Why <Image /> do not work anymore with Vercel

Link to Minimal Reproducible Example

vercel

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 3, 2024
@lilnasy lilnasy added the needs repro Issue needs a reproduction label Jan 3, 2024
Copy link
Contributor

github-actions bot commented Jan 3, 2024

Hello @ohrrkan. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Jan 3, 2024
@domingouribe
Copy link

Hello. I had the same problem. I solved it by first updating Node to version 20.10. I was working with version 18. Then I updated Astro and the dependencies. And finally I manually installed Sharp with npm (Not with pnpm), and it worked.

Here is a simple project with the solution applied: https://github.com/domingouribe/news-card.git

@ohrrkan
Copy link
Author

ohrrkan commented Jan 5, 2024

Thanks @domingouribe but it do not solved the issue with Vercel. No issue with a vanilla node build but with Vercel integration, sharp will not work.

here is the example base on your example (https://github.com/ohrrkan/test-astro) with the add of Vercel. You can see the difference between "npm run build" : KO (this is with Vercel adapter)

"npm run build:node" : OK (with node adapter)

Upload on Vercel server this will lead to this kind of error but as you can see sharp module is install.

Could not process image request: MissingSharp: Could not find Sharp. Please install Sharp (`sharp`) manually into your project or migrate to another image service.
    at loadSharp (file:///var/task/vercel/path0/dist/chunks/astro/assets-service_zQugzRVo.mjs:327:11)

@ohrrkan
Copy link
Author

ohrrkan commented Jan 5, 2024

ok I find one of the reason. I was not using imageService: true, in the config. This do not explain the warning when building and why it was working before 4.07 but it work with this following astro.config.mjs

import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/static';

export default defineConfig({
  // ...
  output: 'static',
  adapter: vercel({
    imageService: true,
  }),
});

as the warning (info) end with : "This may not be a problem, but it's worth checking." I will close the issue

@ohrrkan ohrrkan closed this as completed Jan 5, 2024
@ohrrkan
Copy link
Author

ohrrkan commented Jan 8, 2024

at the end it is a duplicate of #9345

and my solving :

(vercel({
   imageService: true,
 }),) 

is more a bypass than a real solution of the original issue => it use the Vercel service in place of the sharp astro one. for now I solved it by getting back to sharp "^0.32"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue needs a reproduction
Projects
None yet
Development

No branches or pull requests

3 participants