admin管理员组文章数量:1399770
I have a Next.js (React) application that uses @auth0/nextjs-auth0 for authentication, deployed via Azure App Service and containers (Docker). As of last night or this morning, I can no longer access my application due to server-side errors relating to JWE decryption and auth0 secrets. What's extremely strange is this error only surfaced last night, despite not swapping my main slot into production for 2 weeks.
Context
- Framework: Next.js using the new App Router (13+) and @auth0/nextjs-auth0 (auth library).
- Auth Provider: Okta (the user sees the Okta login screen, then gets redirected back to /auth/callback).
Azure Setup:
- Each branch (Dev, Staging, Main) has its own App Service/deployment slot.
- Production and “prod-like” run the same code from the main branch; I use slot swaps to move changes in.
- The container is built and pushed to Azure Container Registry, then deployed to the App Service.
Auth0 FrontEnd Set Up:
import { Auth0Client } from "@auth0/nextjs-auth0/server";
import { NextResponse } from "next/server";
export const auth0 = new Auth0Client({
authorizationParameters: {
audience: process.env.API_BASE_URL,
scope: 'openid profile email',
},
onCallback: async (error, context) => {
if (error) {
return NextResponse.redirect(
new URL(`/error?error=${error.message}`, process.env.APP_BASE_URL)
)
}
return NextResponse.redirect(
new URL(context.returnTo || "/", process.env.APP_BASE_URL)
)
},
});
The Errors
- Only in the prod-like environment, right after a successful login, the user fails to be redirected to the dashboard. I see errors like:
Error: An error occurred in the Server Components render ...
ERR_JWE_DECRYPTION_FAILED at <anonymous> (/usr/src/.next/server/chunks/603.js:2:93746)
or
TypeError: "ikm"" must be an instance of Uint8Array or a string
at nf (/usr/src/.next/server/chunks/987.js:27:305059)
I’ve running this in an incognito window to see if Cookies had expired. It was still broken.
Thank you! Any guidance or pointers would be extremely helpful.
I have a Next.js (React) application that uses @auth0/nextjs-auth0 for authentication, deployed via Azure App Service and containers (Docker). As of last night or this morning, I can no longer access my application due to server-side errors relating to JWE decryption and auth0 secrets. What's extremely strange is this error only surfaced last night, despite not swapping my main slot into production for 2 weeks.
Context
- Framework: Next.js using the new App Router (13+) and @auth0/nextjs-auth0 (auth library).
- Auth Provider: Okta (the user sees the Okta login screen, then gets redirected back to /auth/callback).
Azure Setup:
- Each branch (Dev, Staging, Main) has its own App Service/deployment slot.
- Production and “prod-like” run the same code from the main branch; I use slot swaps to move changes in.
- The container is built and pushed to Azure Container Registry, then deployed to the App Service.
Auth0 FrontEnd Set Up:
import { Auth0Client } from "@auth0/nextjs-auth0/server";
import { NextResponse } from "next/server";
export const auth0 = new Auth0Client({
authorizationParameters: {
audience: process.env.API_BASE_URL,
scope: 'openid profile email',
},
onCallback: async (error, context) => {
if (error) {
return NextResponse.redirect(
new URL(`/error?error=${error.message}`, process.env.APP_BASE_URL)
)
}
return NextResponse.redirect(
new URL(context.returnTo || "/", process.env.APP_BASE_URL)
)
},
});
The Errors
- Only in the prod-like environment, right after a successful login, the user fails to be redirected to the dashboard. I see errors like:
Error: An error occurred in the Server Components render ...
ERR_JWE_DECRYPTION_FAILED at <anonymous> (/usr/src/.next/server/chunks/603.js:2:93746)
or
TypeError: "ikm"" must be an instance of Uint8Array or a string
at nf (/usr/src/.next/server/chunks/987.js:27:305059)
I’ve running this in an incognito window to see if Cookies had expired. It was still broken.
Thank you! Any guidance or pointers would be extremely helpful.
Share Improve this question asked Mar 26 at 17:50 Oliver ThurstonOliver Thurston 133 bronze badges 1- The error suggests that the session cookie cannot be decrypted, which typically happens when AUTH0_SECRET is missing or different between deployments. – Aslesha Kantamsetti Commented Mar 27 at 9:35
1 Answer
Reset to default 0The problem lied within Bun's v1.2.6 update. Reverting back to 1.2.5 fixed this issue.
本文标签:
版权声明:本文标题:reactjs - Next.js@auth0nextjs-auth0: “ERR_JWE_DECRYPTION_FAILED” Error Only in One Azure Deployment Slot - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744134292a2592323.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论