question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Internal Server Error - TypeError: lowPriorityScripts is not iterable

See original GitHub issue

Bug report

Describe the bug

I have a very basic Next.js App setup, and everything works just perfectly on development. But as soon as I build the app and deploy to the server, it doesn’t render the default 404 page, but instead shows:

Internal server error

To Reproduce

  1. Build the next app, using “next build”
  2. Deploy it to ubuntu server (Nginx)
  3. Run the app using “next start -p 8000”
  4. Go to a random route that doesn’t exist (e.g. /xyz)

What is working

The development and even production build if served via “next start” on my mac.

Expected behavior

The default 404 page should be rendered, instead of the error “Internal server error”.

Error Log

TypeError: lowPriorityScripts is not iterable
at NextScript.getScripts (/home/ubuntu/app/.next/server/static/-w_wsy_dLbzAUuf_h5xwp/pages/_document.js:824:34)
at NextScript.render (/home/ubuntu/app/.next/server/static/-w_wsy_dLbzAUuf_h5xwp/pages/_document.js:948:182)
at processChild (/home/ubuntu/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:3293:18)
at resolve (/home/ubuntu/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:3124:5)
at ReactDOMServerRenderer.render (/home/ubuntu/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:3598:22)
at ReactDOMServerRenderer.read (/home/ubuntu/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:3536:29)
at Object.renderToStaticMarkup (/home/ubuntu/app/node_modules/react-dom/cjs/react-dom-server.node.development.js:4261:27)
at renderDocument (/home/ubuntu/app/node_modules/next/dist/next-server/server/render.js:91:18)
at Object.renderToHTML (/home/ubuntu/app/node_modules/next/dist/next-server/server/render.js:369:16)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

Server information

  • OS: Ubuntu
  • Browser: Chrome
  • Version of Next.js: [e.g. 9.1.7]

Additional Information

I have a customized _document.js if that can cause some issue.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Timercommented, Mar 30, 2020

You’re likely not copying your package-lock.json or yarn.lock to your production server before dependency install, causing a Next.js version mismatch.

2reactions
jkjustjoshingcommented, Mar 31, 2020

When I was on Next.js v9.1, I was able to do the equivalent of the following:

npm ci
next build
rm -rf node_modules
npm ci --only=production
next start

to reduce the size of my production Docker image. Upgrading to Next.js >= 9.2, I’m getting the above error.

Is there a solution to this that doesn’t involve including all my dev dependencies on production? I really don’t want to pay for storage space to hold my storybook, unit testing, and linting dependencies that aren’t used in production.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Internal Server Error - TypeError: lowPriorityScripts is not iterable
I am facing the same issue while deployment. TypeError: lowPriorityScripts is not iterable. This build is working fine in local environment but ...
Read more >
TypeError: 'x' is not iterable - JavaScript - MDN Web Docs
The JavaScript exception "is not iterable" occurs when the value which is given as the right-hand side of for...of, as argument of a...
Read more >
Int Object is Not Iterable – Python Error [Solved]
If you are running your Python code and you see the error “TypeError: 'int' object is not iterable”, it means you are trying...
Read more >
"TypeError: object is not iterable (cannot read property Symbol ...
I am making controlled components in React and I am using states and seting states in forms. But this error occurs ...
Read more >
CAPM: undefined is not iterable - SAP Community
However, I am getting error in cds watch logs that 'TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found