TypeError: URL is not a constructor

Anyone know how to fix this error? It came out of no where as I was building my create-next-app@latest. Things I've tried: - Restarted VS code and Mac - Deleted .next, package-lock.json and node_modules then reinstalled - Prompted GPT-4 to death trying to find solution... - Slept on it over night hoping I would wake up and the problem would be gone - First: commented out recently written code to try narrow down the problem cause - Second: started stripping my whole app trying to find anything that was causing it. - Third: my app is now pretty much a home page with stripped functionality and commented out endpoints, still got the error - Come to the conclusion that theres no way it can be from my actual written code, especially since the error is in next source files - Scoured YT and forms for answer... nothin. Any help is really appreciated, its stopped me dead in my tracks, can't proceed without fixing. Page says: Internal server error. Extra: After restarting VS code, it fixes it, only temporarily until I start navigating on the page or using any functionality, or even refreshing, it immediately breaks and throws the same error. ERROR MESSAGE:
TypeError: URL is not a constructor
at parseRelativeUrl (/Users/admin/Desktop/stuff/devWork/inter-ai-next/node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js:14:24)
at parseUrl (/Users/admin/Desktop/stuff/devWork/inter-ai-next/node_modules/next/dist/shared/lib/router/utils/parse-url.js:15:55)
at DevServer.handleRequestImpl (/Users/admin/Desktop/stuff/devWork/inter-ai-next/node_modules/next/dist/server/base-server.js:335:48)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
TypeError: URL is not a constructor
at parseRelativeUrl (/Users/admin/Desktop/stuff/devWork/inter-ai-next/node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js:14:24)
at parseUrl (/Users/admin/Desktop/stuff/devWork/inter-ai-next/node_modules/next/dist/shared/lib/router/utils/parse-url.js:15:55)
at DevServer.handleRequestImpl (/Users/admin/Desktop/stuff/devWork/inter-ai-next/node_modules/next/dist/server/base-server.js:335:48)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Nothing in dev tools console, nothing in network, the above error is all I have.
10 Replies
Neto
Neto13mo ago
can you show the code?
second1
second113mo ago
Sure I have a few pages and api routes, anything in particular?
second1
second113mo ago
GitHub
GitHub - 0x4337/InterAI at create-interview-page
A NextJS 13 rewrite of a once cra InterAI, a platform that allows you to practice your interview skills with dynamic, AI powered questions and responses. - GitHub - 0x4337/InterAI at create-intervi...
second1
second113mo ago
theres some auth stuff, however I've commented it out and it didnt fix so i just uncommented it again, similarly for alot of functionality
Neto
Neto13mo ago
in that route the error happened?
laurie3603
laurie360313mo ago
what do you get for node -v? 'URL is not a constructor' makes it sounds like you are in an env that does not support new URL.
second1
second113mo ago
v18.14.2
Sybatron
Sybatron13mo ago
i think i found you problem it's the 'recordrtc' in this discussion https://github.com/vercel/next.js/discussions/15965
GitHub
URL is not a constructor error · vercel next.js · Discussion #15965
Hi, I've tried to upgrade Next from 9.4.4 to latest and this wild error appear. This is very strange cause i'm using Node v12. The strange thing is i try to debug to find reason why this er...
Sybatron
Sybatron13mo ago
hope you can find answer in it
second1
second113mo ago
Thank you!! Gonna take a look through tomorrow but that sounds promising. I really appreciate it!!!!
Want results from more Discord servers?
Add your server
More Posts