Static content not loading after migration to Next.js v12 & @netlify/plugin-nextjs v4

Site name: vigorous-bell-99b0d9

Hey, we recently migrated from Next.js v11.1.3 to v12.1.0 while also upgrading the following:
@netlify/plugin-nextjs: from v3.9.2 to v4.2.7
netlify-cli: from v8.0.1 to v9.8.3

After our project is being build using the command netlify build --offline it is getting deployed on netlify upon which it is not able to load static contents like css & js:

In the build logs, we’re getting this:

...
(build.command completed in 1m 10.9s)
​
────────────────────────────────────────────────────────────────
  3. @netlify/plugin-nextjs (onBuild event)                     
────────────────────────────────────────────────────────────────
​
Patching /home/[REDACTED]/node_modules/next/dist/server/base-server.js
Done
Moving static page files to serve from CDN...
Moved 42 files
Netlify configuration property "redirects" value changed to [
  { from: '/_next/static/*', to: '/static/:splat', status: 200 },
  {
    from: '/_next/image*',
    query: { url: ':url', w: ':width', q: ':quality' },
    to: '/_ipx/w_:width,q_:quality/:url',
    status: 301
  },
  { from: '/_ipx/*', to: '/.netlify/builders/_ipx', status: 200 },
  { from: '/cache/*', to: '/404.html', status: 404, force: true },
  { from: '/server/*', to: '/404.html', status: 404, force: true },
  { from: '/serverless/*', to: '/404.html', status: 404, force: true }
...

so netlify is setting redirect rules as much as I can understand but on trying to load the website it’s still calling _next as seen in the first screenshot.
Kindly help by letting us know, is there any custom step we need to take care of to either change the static content path in html files or to redirect properly?

Hey @teamdeveleven :wave:

Thanks for reaching out, and welcome to the Netlify Forums! Can you please share your project repo? I’ll loop in my team member who can look into this further for you.

1 Like

I’m having the same issue since Next 12 when deploying from my local machine.

The console says ‘Netlify configuration property “redirects” value changed to [’

But the redirects aren’t created in the deployment, so the site isn’t working.

It only works if I translate the redirect JSON output into YAML and save it in netlify.toml

Hey there, @eelco :wave:

Thanks for reaching out! Can you please share a link to your site as well as your project repo? We need a few more details here in order to look into this further.

Thanks Hillary,

I seem to have figured it out.

I was running build and deploy separately. But when I run netlify deploy --prod --build in one go it deploys correctly.

2 Likes

Thanks for coming back and letting us know! Glad everything is working now. :rocket: