Error when migrate to nextjs-auth0 v4.1 Cannot find module '@/lib/auth0'

Ready to post? :magnifying_glass_tilted_left: First, try searching for your answer.
Hi,

I try t migrate from V2.7 to V4.1
My source using folder src.
I create file src/lib/auth0.ts

import { Auth0Client } from '@auth0/nextjs-auth0/server'

export const auth0 = new Auth0Client({
  authorizationParameters: {
    audience: process.env.AUTH0_AUDIENCE,
    scope: process.env.AUTH0_SCOPE
  }
})

I put path in tsconfig.server.json

    "baseUrl": ".",
    "paths": {
      "@/lib/*": ["src/lib/*"]
    }

I imported into server/services/auth.ts

import { auth0 } from '@/lib/auth0'

And get the error when run ‘yarn dev’

[nodemon] starting `ts-node --project tsconfig.server.json server/index.ts`
Error: Cannot find module '@/lib/auth0'

try to add path to tsconfig.json and still get the same error.
Please help me.

Ready to post? :magnifying_glass_tilted_left: First, try searching for your answer.
Hi,
I get this error when using node version 22 and try to run ‘yarn dev’ for nextjs-auth0 version 4.1
Please help me.

Hi @nguyen.cao

Welcome to the Auth0 Community!

Thank you for posting your question!

Can you open up a new issue in the Next.js Auth0 repository → GitHub · Where software is built and link it here. After that I will ping the repo owners to check your issue and address it!

Thanks
Dawid

Hi @dawid.matuszczyk
I created issued in github.
How can I link it?

I got it for you!

1 Like

Thank you @dawid.matuszczyk .
Looking forward to get feedback soon.

Hi,
Do we have a feedback for this bug?