Skip to content

The ReferenceError: React is not defined error when using @auth0/nextjs-auth0/server #2328

@BohdanYavorskyi

Description

@BohdanYavorskyi

Checklist

Description

Hi everyone!

I’m currently trying to migrate my nextjs app to v4. I went through all the docs, examples, and I am already stuck on the first step when simply using auth0 client instance in middleware. I’m getting React not defined error and could not find any similar topics. I’m importing the Auth0Client class from /server path (which should not use any React imo) and getting the error.

I’m using the Pages router, and NextJS version is 14.2.32.

Reproduction

Just import the Auth0 client instance in middleware from lib.auth0.

Additional context

No response

nextjs-auth0 version

4.10.0

Next.js version

14.2.32

Node.js version

18.20

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions