Next/image 502 response - Cannot find module './utils'

Hello! I’ve setup a brand new app using:
yarn create next-app --typescript

and then I added an image which works great locally but when deployed I’m getting the following responses from the server:

Runtime.ImportModuleError: Error: Cannot find module './utils'
Require stack:
- /var/task/node_modules/unstorage/dist/drivers/fs.cjs
- /var/task/node_modules/@netlify/ipx/dist/http.js
- /var/task/node_modules/@netlify/ipx/dist/index.js
- /var/task/.netlify/functions-internal/_ipx/_ipx.js
- /var/task/_ipx.js
- /var/runtime/UserFunction.js
- /var/runtime/Runtime.js
- /var/runtime/index.js
    at _loadUserApp (/var/runtime/UserFunction.js:221:13)
    at Object.module.exports.load (/var/runtime/UserFunction.js:279:17)
    at Object.<anonymous> (/var/runtime/index.js:43:34)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47

you can find the site here:
Site with issue

Any help is much appreciated! Thanks!

I am getting the same issue on my end.

Example with error:,q_100/%2F_next%2Fstatic%2Fmedia%2Fhome-header-v2.4eb9cc78.png?url=%2F_next%2Fstatic%2Fmedia%2Fhome-header-v2.4eb9cc78.png&w=3840&q=100

This may be related: Netlify Next.js images throw IPX Error 500

I am getting the same issue

Same here. Everything was fine from the deploy last week, but as of this morning, images won’t appear. I have a 502 with the same error message you posted. This is my site:

My Next images are broken on my site as well. Has anyone found a workaround?

Same here!

I’ve been dealing with this issue since this morning. I’ve tried several methods like downgrading the plugin, clearing cache & redeploy, and so on. But none of them actually works.

However, when I go back to the previous ‘working’ deploy, it works fine. Thus, my temporary solution at the moment is going back to publish the latest ‘working’ deploy.

Here is my published site:

My latest deploy (with error):

I am in the same boat! Looks like it just started within the last 24hrs? Does anyone know if this is specifically a Next.js problem?

Not certain of the cause quite yet, but our dev team is looking into it for us now and we should have some news about a fix soon!

Hey folks, just got a fix out with plugin v 4.9.2: Release plugin-nextjs: v4.9.2 · netlify/next-runtime · GitHub . In it we protect against the cause of the problem, which was created in a dependency that was later fixed (unstorage - npm).

Please let us know if you cannot successfully use the new plugin version going forward!


I added 4.9.2 and that seems to have cleared up the issue. Thanks!
yarn add @netlify/plugin-nextjs@4.9.2 --dev

1 Like

Problem solved - izzzy

It seems the upgrade worked on one project but not another. This one still has the issue:
Broken Image

This is my first experience with Netlify so I’m not sure if I’m doing something wrong. Thanks for the help.

Did you try to clear cache and deploy? Also, you could try to deploy it on a new site.

I think it was because I had installed ipx trying to work around the problem. I removed everything and upgrade to the latest and it’s working now. Thank you.