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:
Nothing in dev tools console, nothing in network, the above error is all I have.
10 Replies
can you show the code?
Sure I have a few pages and api routes, anything in particular?
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...
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
in that route the error happened?
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.
v18.14.2
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...
hope you can find answer in it
Thank you!! Gonna take a look through tomorrow but that sounds promising. I really appreciate it!!!!