Next.js Discord

Discord Forum

Element type is invalid

Unanswered
Black Vulture posted this in #help-forum
Open in Discord
Black VultureOP
I received this error: Element type is invalid. Received a promise that resolves to: undefined. Lazy element type must resolve to a class or function.

It only gives this error on the nav bar. I just upgraded to Next.js 14. It didn't give this error on 13.


Here is the layout:
export default async function RootLayout({ children }: { children: React.ReactNode }) {
    const userSession = await getPageSession();
    let user;
    if (userSession) {
        user = await getUserById(userSession.user.userId);
    } else {
        user = null;
    }
    return (
        <html lang='en'>
            <body>
                <ThemeRegistry>
                    <Navbar />
                </ThemeRegistry>
            </body>
        </html>
    );
}


Here is the Navbar.
export default function Navbar() {
    return (
        <Box component='div' sx={{ flexGrow: 1 }}>
            <div>Navbar</div>
        </Box>
    );
}

0 Replies