I'm using a custom env var naming scheme in order to provide env vars at deploy time.
I am able to supply the publishableKey as a parameter to the middleware,
exportdefaultauthMiddleware({publishableKey: process.env.ENV_VAR_NAME,asyncafterAuth(auth,req,evt){if(!auth.isPublicRoute){if(!auth.userId){// eslint-disable-next-line @typescript-eslint/no-unsafe-returnreturnredirectToSignIn({but when I call redirectToSignIn within afterAuth, I am getting an error:
Server Error
Error: Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
src/middleware.ts (45:40) @ afterAuth
44 | // eslint-disable-next-line @typescript-eslint/no-unsafe-return
> 45 | return redirectToSignIn({
| ^
46 | returnBackUrl: ...,
48 | });
I'm using a custom env var naming scheme in order to provide env vars at deploy time.
I am able to supply the publishableKey as a parameter to the middleware,
but when I call
redirectToSignInwithin afterAuth, I am getting an error: