Next.js Discord

Discord Forum

TypeError: iz is not a constructor

Unanswered
Chris posted this in #help-forum
Open in Discord
I'm at a bit of a loss with this 1 - when i navigate to any client side route in production I'm getting this error. Before I upgraded to Next v14.1, the error was "iV is not a constructor".

I've tried turning off the next-auth middleware I have running. I've also tried it on a route that just returns a <div>. I've deleted the build cache, and package-lock.json.

I don't get the error when running locally, so I've made sure the node and npm versions match what's in production.

Any help would be appreicated!

2024-02-20T19:44:20.224609+00:00 app[web.1]:  ⨯ TypeError: iz is not a constructor
2024-02-20T19:44:20.224636+00:00 app[web.1]:     at iB (/app/.next/server/chunks/973.js:373:50463)
2024-02-20T19:44:20.224636+00:00 app[web.1]:     at t (/app/.next/server/chunks/973.js:373:56275)
2024-02-20T19:44:20.224637+00:00 app[web.1]:     at /app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:42490
2024-02-20T19:44:20.224638+00:00 app[web.1]:     at /app/node_modules/next/dist/server/lib/trace/tracer.js:133:36
2024-02-20T19:44:20.224640+00:00 app[web.1]:     at NoopContextManager.with (/app/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)
2024-02-20T19:44:20.224640+00:00 app[web.1]:     at ContextAPI.with (/app/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:518)
2024-02-20T19:44:20.224641+00:00 app[web.1]:     at NoopTracer.startActiveSpan (/app/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18093)
2024-02-20T19:44:20.224641+00:00 app[web.1]:     at ProxyTracer.startActiveSpan (/app/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18854)
2024-02-20T19:44:20.224641+00:00 app[web.1]:     at /app/node_modules/next/dist/server/lib/trace/tracer.js:122:103
2024-02-20T19:44:20.224641+00:00 app[web.1]:     at NoopContextManager.with (/app/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)

5 Replies

Bump
It seems to be caused by the api/auth/session route, will build trial project from scratch to see if I can replicat
Solved: it seems as though when updating to a more recent version of next-auth (authjs) the url environment variable could be deleted, however I initially found a stack overflow answer that had said to add api/url at the end of the environment variable.

By deleting the variable entirely, the error seems to have gone away
Not quite solved - next auth now redirects me to localhost in production
Resolved by reverting to next-auth v5.0.0-beta.4