-
Link to reproductionNo response Payload Version3.0.0-beta.36 Node Versionv21.4.0 Next.js Version15.0.0-rc.0 Describe the BugI can't fetch images from the local api and display them in an component In dev mode everything works fine
And it works just fine. The But when i deployed it to Vercel when going to https://starbucks-clone-orpin.vercel.app/api/media/file/137-92091.jpeg the image loads but when the Reproduction StepsRepository : https://github.com/poofy25/starbucks-clone
Adapters and Plugins@payloadcms/storage-uploadthing |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 4 replies
-
I'm getting the same error when trying to display images in a Vercel deployment using a Supabase S3 bucket. Any solutions? |
Beta Was this translation helpful? Give feedback.
-
So i found a workaround for this issue all you gotta do is add the website url in the image src path Before: After |
Beta Was this translation helpful? Give feedback.
-
Hey all, yes, as @poofy25 said, on your frontend, I believe you need to pass full URLs to the |
Beta Was this translation helpful? Give feedback.
-
This isn't working when using S3 bucket storage and Vercel deployment. Even using absolute urls. |
Beta Was this translation helpful? Give feedback.
-
Also getting this error still. @jmikrut Can we have someone relook into this? |
Beta Was this translation helpful? Give feedback.
-
Im also running with this issue, using absolute url does not fix the issue. Clicking and redirecting to the path it actually returns the image https://your-site/api/media/file/photo.png but when rendering in the next image getting the same error 400: BAD_REQUEST |
Beta Was this translation helpful? Give feedback.
-
Same problem here, having absolute url doesnt fix it. |
Beta Was this translation helpful? Give feedback.
-
I understand the argument to close the issue that the problem is with Next's image optimizer, but at the same time if Payload intends to have a default configuration that can be hosted on Vercel, the team needs to worry about this issue. Once there is a stable version available to a wider audience, this problem will make it impossible to use without headaches. |
Beta Was this translation helpful? Give feedback.
-
I agree. Also, for this to work, we have to add localhost to the next config allowed remote paths. This seems odd -- if they are running in the same sever, a FQDN should not be required. I believe this logic could be pushed down into Payload. I also agree this is a pretty significant thing for the masses who are about to roll into Payload from nextjs. They just need the image component to simply work. Absolute URL is also not working for me with next/image and vercel blob -- now I'm hard blocked on this!! |
Beta Was this translation helpful? Give feedback.
-
I was working with S3 bucket and Next.js 15 I just added "unoptimized" in the component and it solved the issue 😶🌫️ |
Beta Was this translation helpful? Give feedback.
So i found a workaround for this issue all you gotta do is add the website url in the image src path
For example
Before:
<Image src={image.url} ...>
After
<Image src={
${process.env.WEBSITE_URL}${image.url}
} />