needle-engine-support icon indicating copy to clipboard operation
needle-engine-support copied to clipboard

vConsole is failing in Next.js app router

Open kristofferso opened this issue 1 year ago • 6 comments

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 🩹

kristofferso avatar Jan 24 '24 08:01 kristofferso

Do you see this error in vconsole? Can you check the stacktrace? The error might be misleading

marwie avatar Jan 24 '24 09:01 marwie

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?

kristofferso avatar Jan 24 '24 14:01 kristofferso

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)

marwie avatar Jan 24 '24 17:01 marwie

This is from the browser console. The virtual console doesn't load. The same error happens in your Next.js starter project.

kristofferso avatar Jan 25 '24 11:01 kristofferso

Hi, I just tried with our template and I don't get the error there Do you refer to a different starter project?

marwie avatar Jan 26 '24 04:01 marwie

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

kristofferso avatar Jan 30 '24 10:01 kristofferso