Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CacheKey clientId field type does not match string | undefined #760

Open
6 tasks done
malinskibeniamin opened this issue May 5, 2024 · 0 comments
Open
6 tasks done
Labels
bug Something isn't working

Comments

@malinskibeniamin
Copy link

Checklist

Description

When building any NextJS app, validity of types will fail when using @auth0/auth0-react package.

The package works fine in development, but the build will fail because of the clientId being

Reproduction

  1. Clone any NextJS 14 app router example
  2. Use @auth0/auth0-react
  3. Run npm run build
  4. Notice the error

Additional context

> next build

   Next.js 14.2.3
  - Environments: .env

   Creating an optimized production build ...
  Compiled successfully

   Linting and checking validity of types  ..Failed to compile.

./node_modules/@auth0/auth0-spa-js/src/cache/shared.ts:45:27
Type error: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.

  43 |     const [prefix, clientId, audience, scope] = key.split('::');
  44 |
> 45 |     return new CacheKey({ clientId, scope, audience }, prefix);
     |                           ^
  46 |   }
  47 |
  48 |   /**

auth0-react version

2.2.4

React version

18.3.1

Which browsers have you tested in?

Chrome

@malinskibeniamin malinskibeniamin added the bug Something isn't working label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant