Error: A valid Auth0 Client Secret must be provided on Vercel
Error: A valid Auth0 Client Secret must be provided on Vercel
您好,我正在尝试在 Vercel 上部署应用程序,在预览时一切正常,但在生产中它失败并出现此错误。我正在使用 @auth0/nextjs-auth0
版本 ^0.16.1
08:18:12.508 > Build error occurred
08:18:12.510 Error: A valid Auth0 Client Secret must be provided
08:18:12.510 at Object.createInstance [as default] (/vercel/workpath0/node_modules/@auth0/nextjs-auth0/dist/instance.node.js:16:15)
08:18:12.510 at initAuth0 (/vercel/workpath0/node_modules/@auth0/nextjs-auth0/dist/index.js:9:46)
auth0配置文件,和官方文档一样
import { initAuth0 } from '@auth0/nextjs-auth0';
export default initAuth0({
domain: process.env.AUTH0_DOMAIN,
clientId: process.env.AUTH0_CLIENT_ID,
clientSecret: process.env.AUTH0_CLIENT_SECRET,
scope: 'openid profile',
redirectUri: 'http://localhost:3000/api/callback',
postLogoutRedirectUri: 'http://localhost:3000/',
session: {
// The secret used to encrypt the cookie.
cookieSecret: process.env.COOKIE_SECRET,
// The cookie lifetime (expiration) in seconds. Set to 8 hours by default.
cookieLifetime: 60 * 60 * 8,
// (Optional) The cookie domain this should run on. Leave it blank to restrict it to your domain.
cookieDomain: 'your-domain.com',
// (Optional) SameSite configuration for the session cookie. Defaults to 'lax', but can be changed to 'strict' or 'none'. Set it to false if you want to disable the SameSite setting.
cookieSameSite: 'lax',
// (Optional) Store the id_token in the session. Defaults to false.
storeIdToken: false,
// (Optional) Store the access_token in the session. Defaults to false.
storeAccessToken: false,
// (Optional) Store the refresh_token in the session. Defaults to false.
storeRefreshToken: false
},
oidcClient: {
// (Optional) Configure the timeout in milliseconds for HTTP requests to Auth0.
httpTimeout: 2500,
// (Optional) Configure the clock tolerance in milliseconds, if the time on your server is running behind.
clockTolerance: 10000
}
});
不幸的是,env
变量 clientSecret: process.env.AUTH0_CLIENT_SECRET
在生产构建中以某种方式被禁用。
您好,我正在尝试在 Vercel 上部署应用程序,在预览时一切正常,但在生产中它失败并出现此错误。我正在使用 @auth0/nextjs-auth0
版本 ^0.16.1
08:18:12.508 > Build error occurred
08:18:12.510 Error: A valid Auth0 Client Secret must be provided
08:18:12.510 at Object.createInstance [as default] (/vercel/workpath0/node_modules/@auth0/nextjs-auth0/dist/instance.node.js:16:15)
08:18:12.510 at initAuth0 (/vercel/workpath0/node_modules/@auth0/nextjs-auth0/dist/index.js:9:46)
auth0配置文件,和官方文档一样
import { initAuth0 } from '@auth0/nextjs-auth0';
export default initAuth0({
domain: process.env.AUTH0_DOMAIN,
clientId: process.env.AUTH0_CLIENT_ID,
clientSecret: process.env.AUTH0_CLIENT_SECRET,
scope: 'openid profile',
redirectUri: 'http://localhost:3000/api/callback',
postLogoutRedirectUri: 'http://localhost:3000/',
session: {
// The secret used to encrypt the cookie.
cookieSecret: process.env.COOKIE_SECRET,
// The cookie lifetime (expiration) in seconds. Set to 8 hours by default.
cookieLifetime: 60 * 60 * 8,
// (Optional) The cookie domain this should run on. Leave it blank to restrict it to your domain.
cookieDomain: 'your-domain.com',
// (Optional) SameSite configuration for the session cookie. Defaults to 'lax', but can be changed to 'strict' or 'none'. Set it to false if you want to disable the SameSite setting.
cookieSameSite: 'lax',
// (Optional) Store the id_token in the session. Defaults to false.
storeIdToken: false,
// (Optional) Store the access_token in the session. Defaults to false.
storeAccessToken: false,
// (Optional) Store the refresh_token in the session. Defaults to false.
storeRefreshToken: false
},
oidcClient: {
// (Optional) Configure the timeout in milliseconds for HTTP requests to Auth0.
httpTimeout: 2500,
// (Optional) Configure the clock tolerance in milliseconds, if the time on your server is running behind.
clockTolerance: 10000
}
});
不幸的是,env
变量 clientSecret: process.env.AUTH0_CLIENT_SECRET
在生产构建中以某种方式被禁用。