vConsole is failing in Next.js app router
Describe the bug 💬
When running a Next.js project with the app router in dev I get the following error when reloading the page on mobile or when the browser simulates a mobile. I suspect it's because vConsole only loads when the screen size is less than a certain amount.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
at vconsole.min.js:10:221845
Next.js version 14.0.3
Operating System 👩💻
macOS
What browsers are you seeing the problem on? 🏄♂️
Chrome
Editor Version 🎲
2020.3
Needle Exporter version
3.31
Project Info (Unity only) 📜
No response
Steps to reproduce 🔢
1. Run `npm run dev`
2. Enter device preview mobile from developer console
3. Refresh page
4. See that the scene is stuck at loading because vconsole fails
...
Reproduction ♻
No response
Discord or Discussion link
No response
Validations 🩹
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Needle-Engine-specific issue. For example if it's a Unity related bug, it should be reported to Unity instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [ ] The provided reproduction is a minimal reproducible example of the bug.
Do you see this error in vconsole? Can you check the stacktrace? The error might be misleading
No I can't see anything in vconsole because it doesn't load.
The stack trace is just 60+ repeats of:
Promise.then (async)
readData @ three.module.js:42216
eval @ three.module.js:42235
Any ideas?
Is it the same in the regular browser console? Can you see what is evaluated there? (Since you said it also happens in e.g. chrome with mobile emulation)
This is from the browser console. The virtual console doesn't load. The same error happens in your Next.js starter project.
Hi, I just tried with our template and I don't get the error there Do you refer to a different starter project?
Right, I should have specified in my last comment that this is for the app router. I made a fork of the repo that reproduces the error: https://github.com/kristofferso/needle-test/tree/main/src