-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Astro Image component does'nt work in production in Vercel #4536
Comments
@GeoBrodas are you seeing this issue in a static build, or are you using the Any chance you have access to build errors or anything that may help us narrow this down as well? |
FYI I am seeing similar. Using Astrowind template. Trying to write a list of posts and no matter what I do I can't get the images to display. https://gist.github.com/wiverson/ae5dbbc7db465632e093c41928f613c7 |
Everything works fine locally and fails when I try to deploy to Vercel. |
High level repro steps:
I tried a bunch of different variants for rewriting the URLs fed into Picture, and nothing worked. Several variants worked in local dev but all failed with a similar error when I tried to deploy to Vercel. I don't really understand why the Picture component works in the individual posts and also on the post list, but not in the code above. As a workaround I may fall back to putting images in the public directory instead of the data directory, or even worse duplicating as I'm seeing a bunch of other bugs reported related to Picture not finding/working with images in public. Let me know if you need anything else to repro/resolve. |
One more bit of info: This works:
But this...
Fails horribly, even though post.frontmatter.url is a string that is the same value as the colors.jpg above.
|
Facing the same issue using Netlify with SSR. Locally in I created a minimal reproduction repo just using |
I'm having a similar issue. In my case, no images are displayed on Vercel production deployments when I use SSR. With SSG, everything works fine. |
@wiverson your gist is a 404 for me, is it private perhaps?
This doesn't work in Astro. Vite has to know the path in order to build it. So you can only use static strings here. Maybe this is your issue. @GeoBrodas Can you share an example that fails? |
Wasn't me tho 😄 |
@matthewp I actually got it working with this new gist: https://gist.github.com/wiverson/697779257b9979ca07f3048f2bcad97d I went back and forth a bit with the author of Astrowind and got it sorted out, now it's working with this version. IIRC turned out to be a bit of fiddly path weirdness, where the path was resolving correctly with one configuration in dev but not in prod. The version above works correctly. |
Ok great, so it seems that this issue was mixed between Vercel SSR, Vercel static (resolved) and Netlify (new issue). So I'm going to close this one. @GeoBrodas if you can share a failing example please open a new issue with it, thanks! |
What version of
astro
are you using?1.0.9
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Windows
Describe the Bug
The Image component seems to work perfect in development, but doesn't work in production when deployed on Vercel. I had to rever back to the normal
<img />
tag for the image to be displayed. I believe this is a bug.Link to Minimal Reproducible Example
Occurs when deployed to Vercel
Participation
The text was updated successfully, but these errors were encountered: