_next/image request misses to send header on production
Unanswered
Snowshoe posted this in #help-forum
SnowshoeOP
The request are as follow
http://localhost:3000/_next/image?url=/api/image
Headers:
Cookie: site_cookie=eyJhJWTToken
And on the api, using
Seems like there might be a regression, as it has worked before before a next upgrade.
http://localhost:3000/_next/image?url=/api/image
Headers:
Cookie: site_cookie=eyJhJWTToken
And on the api, using
cookies()
from "next/headers" it returns emptyh { _parsed: Map(0) {}, _headers: Headers {} }
Seems like there might be a regression, as it has worked before before a next upgrade.
7 Replies
@Snowshoe The request are as follow
http://localhost:3000/_next/image?url=/api/image
Headers:
Cookie: site_cookie=eyJhJWTToken
And on the api, using `cookies()` from "next/headers" it returns empty
`h { _parsed: Map(0) {}, _headers: Headers {} }`
Seems like there might be a regression, as it has worked before before a next upgrade.
Good edge case, I suggest you report a bug on GitHub
SnowshoeOP
actually i managed to reproduce it on non-production aswell
i might try to make a simple reproducible?
SnowshoeOP
unless it might not be a regression, but an intended thing, to not to be used with authentication due to it caching the image?
That’s actually a good point tbh…
Honestly I would just use raw <img> for this to not have to rely on any internal next/image caching shenanigans, then in your /api/image endpoint use sharp to manually convert the image to webp if you haven’t already