Might be missing something out here....
Unanswered
gin posted this in #help-forum
ginOP
Lets keep it simple:
The image request goes trough my backend -> This is the url i receive. Everything is correct.
Now what happens is that one of my functions loads another but same image component with the same exact image ->
for some reason tho the path is now null
Does it have something to do with next/image or my thirdparty dedicated
<Image
src={
evidence.thumbnail
? `https://blablabla.de/evidence/${evidence.thumbnail}`
: ""
}
width={160}
height={80}
style={{borderRadius: "10px"}}
alt={"Thumbnail"}
/>The image request goes trough my backend -> This is the url i receive. Everything is correct.
/51c6834a-5ee8-3993-9eae-59b86a739bc9/0/thumb.jpgNow what happens is that one of my functions loads another but same image component with the same exact image ->
<Image
src={`https://blablabla.de/evidence/${currentEvidence?.thumbnail}`}
width={730}
height={0}
quality="100"
style={{
height: "700px",
width: "100%",
borderRadius: "10px",
boxShadow: "0px 0px 100px 82px rgba(255, 255, 255, 0.09)",
}}
alt="Thumbnail"
/>for some reason tho the path is now null
/nullDoes it have something to do with next/image or my thirdparty dedicated
29 Replies
ginOP
When i manually go on the url where the image is served i get my image back
and console shows me that it requested the same url but didnt get a answer back since my middleware fails because the path is null
and i need the information
Giant ichneumon wasp
I think currentEvidence might be null/undefined initially. Try console logging that value in your component
but the path is defined since it shows me the request in the console
with the right url
Giant ichneumon wasp
Ah I see what you're saying. If you write the src of the second Nextimage the way you did the first one, any difference?
take a look at the url
same url again ->
kinda starting to figure out something
i never received the request on the first screenshot
nextjs might be caching the image
oh yeah
im starting to see the issue
nextjs is caching all request with the same url
even tho the image is changing
this might be the issue
i will attach a random string probably the date in unix epoch
to the url
or is there a way to disable caching @Giant ichneumon wasp
the main issue is how i save my images
i use a already defined uuid and when for example i reupload something for that uuid the paths ofc wont change
will be still -> /uuid/0/image.jpg
so the easiest and most optimized way would be to randomize the imagename itself
think thats better instead of appending some random searchparam
Giant ichneumon wasp
Yeah that makes sense. I'm glad you solved it!