400 bad request after trying to access just uploaded image
Unanswered
Taiwan Dog posted this in #help-forum
Taiwan DogOP
Greetings! I've encountered issue here, could you please help me? I'm new in Next.js
If I upload an image via form and then access just uploaded image via Next.js Image component or directly via browser url bar I have 400 Bad Request response. Image component says "Could not load the image". Tried to specify domain in config and use Loader, the same result. More than that, I can't access new uploaded images directly via browser url bar. Server console says: "The requested resource isn't a valid image for /uploads/products_18_gallery_1_1699416826325.jpeg received text/html; charset=utf-8". But if I rebuild the project those previously uploaded images finally displays and there is no 400 error. I upload images in /public/uploads directory. This problem happens only in production mode (npm run build, npm run start). There is no such problem when I work with it in dev mode (npm run dev).
What do I do wrong?
If I upload an image via form and then access just uploaded image via Next.js Image component or directly via browser url bar I have 400 Bad Request response. Image component says "Could not load the image". Tried to specify domain in config and use Loader, the same result. More than that, I can't access new uploaded images directly via browser url bar. Server console says: "The requested resource isn't a valid image for /uploads/products_18_gallery_1_1699416826325.jpeg received text/html; charset=utf-8". But if I rebuild the project those previously uploaded images finally displays and there is no 400 error. I upload images in /public/uploads directory. This problem happens only in production mode (npm run build, npm run start). There is no such problem when I work with it in dev mode (npm run dev).
What do I do wrong?