R
Railway•9mo ago
Tyron

Nextjs 13 and Image

Hello team, i wonder does railways support the new version of Nextjs ? Im facing this error : ```"url" parameter is valid but upstream response is invalid"
28 Replies
Percy
Percy•9mo ago
Project ID: N/A
Brody
Brody•9mo ago
we will need more context than that
Tyron
Tyron•9mo ago
Ok my bad, what should i provide for people to understand my issues ?
Brody
Brody•9mo ago
lets start with full error logs
upstream response is invalid
well what are you trying to call?
Tyron
Tyron•9mo ago
No description
Tyron
Tyron•9mo ago
Im trying to display image with the last version of nextjs (Nextjs13)the with <Image src={} alt=""/>
Brody
Brody•9mo ago
so to answer the question, railway supports almost anything, as long as you code it correctly are you using a custom domain?
Tyron
Tyron•9mo ago
No i'm using the free Plan planning to deploy a client app on it and want to test it I got a auto generate domain name by Railways End with : githubname-production.up.railway.app
Brody
Brody•9mo ago
can you give me the full link to the image in question?
Brody
Brody•9mo ago
looks like this is just a code issue and not isolated to railway, please do some research on this topic
Tyron
Tyron•9mo ago
Ok will do, thx for your time Brody ! For people passing by After a few hours of debugging, I've come to the conclusion that railways doesn't support the latest version of nextjs 13.5. Nextjs Image tag is problematic I'll try with a pro plan to see if it's not the free plan that can cause problems.
Brody
Brody•9mo ago
hold on there that is not the case please check this message this issue is not limited to railway and its really not related to your plan type
Tyron
Tyron•9mo ago
Maybe is the Free plan because when im using a TCP connection image are showing, ( forgot to try this ) So basically, the error is from HTTP/HTTPS so the problem is from the server redirecting in https but only serve image from http
Brody
Brody•9mo ago
right, this not an issue with railway or your plan, this is a code issue
Tyron
Tyron•9mo ago
Gonna check for an htaccess if that so
Brody
Brody•9mo ago
that has nothing to do with it railway and your code do not use .htaccess
Floris
Floris•9mo ago
nextjs13 has introduced various new things, also do the documents advise you to use Next/Image and display the image as a component
< ImgToDisplay />
< ImgToDisplay />
that way you're not fetching a url either to get your img
Tyron
Tyron•9mo ago
Yep :
<Image
src={LogoGaziani}
alt="logo"
fill
sizes="(max-width: 768px) 50%, (max-width: 1200px) 50%, 75%"
priority
/>
<Image
src={LogoGaziani}
alt="logo"
fill
sizes="(max-width: 768px) 50%, (max-width: 1200px) 50%, 75%"
priority
/>
Already do that for all my img
Floris
Floris•9mo ago
haha youre amazing!
Tyron
Tyron•9mo ago
Im noob but still i know my basics 😂
Floris
Floris•9mo ago
why dont you call the image from your public folder? instead of a url
Tyron
Tyron•9mo ago
import LogoGaziani from "../../../public/grazianiSansFond.png"; Already call it from public
Floris
Floris•9mo ago
I see does it display local?
Tyron
Tyron•9mo ago
Yep display on local , on vercel also but on railways only in http not in https trying to figure why tho Ok working now, just dont use the Image tag from nextjs or add images: { unoptimized: true, }, Or if really needed stay on vercel ps : It was an issue with Railways not supporting image optimizer from Next not an code error
Floris
Floris•9mo ago
I see Yeah the thing is its impossible to compete with Vercel with NextJs It's theirs
jr
jr•9mo ago
Created an issue to track this internally. We should definitely support this!
Tyron
Tyron•9mo ago
Just a little update with remote Image, even if you not have
images: {
unoptimized: true,
},
images: {
unoptimized: true,
},
It work so it seem to be just on static image