Image uploads with NextJS

Hi all, I’ve been developing a NextJS site, and am getting ready to deploy into production, but I noticed that all images in a NextJS site are optimised when the server starts.

Situation: a user will upload a profile picture, but the image doesn’t appear, even though I can see it exists in the correct folder with the other user photos even if I refresh the page, but if I restart the service using PM2, the image appears now.

Here is my stack (relevant to this situation):
NextJS, Ubuntu 18.04, PM2

Is there a way around this in NextJS, or will I need to write a simple image server using Express and run in parallel with Next?

EDIT: or can anyone recommend an easy out of the box file serving framework? Not that writing one in Node would be hard, just curious.


View Reddit by Cautious_Performer_7View Source

our recommended web hosting companies


website link:


website link:

InMotion hosting

website link:


website link:

Leave a Comment

Your email address will not be published. Required fields are marked *