You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have just upgraded from 4.0.0-beta.10 to 4.0.0-beta.12 and our next build inside a docker container is failing for route handlers that call getAccessToken.
We build our app in docker with no env vars set, so all the Auth0 variables will be missing. We then inject these into the container when it actually runs. Until now this has not been an issue.
But with beta.12 the following route handler will cause next build to error:
Collecting page data ..TypeError: Cannot read properties of undefined (reading 'startsWith')
at new rv (.next/server/chunks/8423.js:1:49131)
at new aR (.next/server/chunks/8423.js:1:95081)
at 44684 (.next/server/app/api/customers/[id]/route.js:1:4294)
at t (.next/server/webpack-runtime.js:1:142)
at 84331 (.next/server/app/api/customers/[id]/route.js:1:1086)
at t (.next/server/webpack-runtime.js:1:142)
at t (.next/server/app/api/customers/[id]/route.js:1:4586)
at <unknown> (.next/server/app/api/customers/[id]/route.js:1:4634)
at t.X (.next/server/webpack-runtime.js:1:1270)
at <unknown> (.next/server/app/api/customers/[id]/route.js:1:4599)
I have tied forcing the routes causing this to by dynamic like this:
export const dynamic = "force-dynamic";
But to no avail.
It appears that this happens if AUTH0_DOMAIN is not set at build time. However, if this is set to an empty string then it works. Any ideas how we can handle this? Could the auth0 code check for undefined to handle this?
Reproduction
Create a new Next.js app with the auth0 beta.
Add a route handler that calls getAccessToken
Run next build without setting AUTH0_DOMAIN
Additional context
No response
nextjs-auth0 version
4.0.0-beta.12
Next.js version
15.1
Node.js version
20
The text was updated successfully, but these errors were encountered:
Note that wrapping getAccessToken in try ... catch does not help either. 😢 we still get the error during the build.
robcaldecott
changed the title
4.0.0-beta.12 throws a startWith error when AUTH0_DOMAIN not set
4.0.0-beta.12 throws a startsWith error when AUTH0_DOMAIN not set
Dec 18, 2024
Hey @robcaldecott, this was a regression introduced in 4.0.0-beta.11. Apologies for the inconvenience here, we'll get this resolved in the upcoming release.
For the time being, setting the AUTH0_DOMAIN environment variable as temporary workaround as you mentioned should ensure the build succeeds.
Checklist
Description
We have just upgraded from
4.0.0-beta.10
to4.0.0-beta.12
and ournext build
inside adocker
container is failing for route handlers that callgetAccessToken
.We build our app in
docker
with no env vars set, so all the Auth0 variables will be missing. We then inject these into the container when it actually runs. Until now this has not been an issue.But with
beta.12
the following route handler will causenext build
to error:This causes the following error:
I have tied forcing the routes causing this to by dynamic like this:
But to no avail.
It appears that this happens if
AUTH0_DOMAIN
is not set at build time. However, if this is set to an empty string then it works. Any ideas how we can handle this? Could the auth0 code check forundefined
to handle this?Reproduction
getAccessToken
next build
without settingAUTH0_DOMAIN
Additional context
No response
nextjs-auth0 version
4.0.0-beta.12
Next.js version
15.1
Node.js version
20
The text was updated successfully, but these errors were encountered: