Next.js Discord

Discord Forum

Unhandled Runtime error with next.js 14

Unanswered
Fire ant posted this in #help-forum
Open in Discord
Fire antOP
I'm constantly getting this error:
Error: Element type is invalid. Received a promise that resolves to: [object Object]. Lazy element type must resolve to a class or function.
The thing is for example I get this error when I do
return( <div>{JSON.stringify(data)}</div> )
When I do
return( <div>{data.name}</div> )
I don't get that error... any idea what the problem could be?

13 Replies

what is the difference between the two:
return(
<div>{JSON.stringify(data)}</div>
)
//When I do
return(
<div>{data.name}</div>
)
Fire antOP
doesn't both return a string?
Btw. this was an example... the main issue is that I don't see where the issue occurs... No hint in the call stack...
drop in some console.logs.
Fire antOP
at mountLazyComponent (react-dom.development.js:16700:9) at beginWork$1 (react-dom.development.js:18351:16) at HTMLUnknownElement.callCallback (react-dom.development.js:20461:14) at Object.invokeGuardedCallbackImpl (react-dom.development.js:20510:16) at invokeGuardedCallback (react-dom.development.js:20585:29) at beginWork (react-dom.development.js:26763:7) at performUnitOfWork (react-dom.development.js:25587:12) at workLoopSync (react-dom.development.js:25303:5) at renderRootSync (react-dom.development.js:25258:7) at performConcurrentWorkOnRoot (react-dom.development.js:24382:74) at workLoop (scheduler.development.js:261:34) at flushWork (scheduler.development.js:230:14) at MessagePort.performWorkUntilDeadline (scheduler.development.js:534:21)
Fire antOP
Sorry, I don't understand. What can I do to support you, in helping me?
nvm, its at the start lol
Fire antOP
Unhandled Runtime Error Error: Element type is invalid. Received a promise that resolves to: [object Object]. Lazy element type must resolve to a class or function.
That's at the beginning of the error message.
@Fire ant
Can I see your full code?
the fact that data.name works fine indicates a proper object. stringifying it in the first example would wreck things
Fire antOP
Sorry for the late answer. Well, this is just one of the possible triggers. I have that often by just having a new component on a new blank page. This error is new to me and never happened using next <v13.