Minified React error #419, Deployment in GCP Cloud Run
Answered
Pink salmon posted this in #help-forum
Pink salmonOP
The error:
Hi, I don't know a lot about this error or how to fix it. Looking for any resources at all to fix this. I'm using Auth.js beta version with next 14.0.3 I can't reproduce the error locally. I'm assuming it has to do with the environment in deployment. People are talking about a CSRF token on stack overflow.
I'm doing beta version of auth.js because I want to use the new v5 stuff, particularly I'm using the middleware authentication style.
My auth config looks like this
fd9d1056-d5cf27fbb7226e9a.js:1 Uncaught Error: Minified React error #419; visit https://reactjs.org/docs/error-decoder.html?invariant=419 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at fd9d1056-d5cf27fbb7226e9a.js:1:64051
at lW (fd9d1056-d5cf27fbb7226e9a.js:1:64922)
at iU (fd9d1056-d5cf27fbb7226e9a.js:1:120218)
at o2 (fd9d1056-d5cf27fbb7226e9a.js:1:94369)
at fd9d1056-d5cf27fbb7226e9a.js:1:94191
at o1 (fd9d1056-d5cf27fbb7226e9a.js:1:94198)
at oB (fd9d1056-d5cf27fbb7226e9a.js:1:90550)
at MessagePort.C (472-bf79027790f23815.js:1:99043)Hi, I don't know a lot about this error or how to fix it. Looking for any resources at all to fix this. I'm using Auth.js beta version with next 14.0.3 I can't reproduce the error locally. I'm assuming it has to do with the environment in deployment. People are talking about a CSRF token on stack overflow.
I'm doing beta version of auth.js because I want to use the new v5 stuff, particularly I'm using the middleware authentication style.
My auth config looks like this
import type { NextAuthConfig } from 'next-auth';
export const authConfig = {
pages: {
signIn: '/login',
},
session: {
strategy: 'jwt',
maxAge: 60 * 60, // 1 hour
},
callbacks: {
authorized({ auth, request: { nextUrl } }) {
const isLoggedIn = !!auth?.user;
const isOnDashboard = nextUrl.pathname.startsWith('/dashboard');
if (isOnDashboard) {
if (isLoggedIn) return true;
return false; // Redirect unauthenticated users to login page
} else if (isLoggedIn) {
return Response.redirect(new URL('/dashboard', nextUrl));
}
return true;
},
jwt: async ({ token, user }) => {
if (user) {
token = { ...token, ...user };
}
return token;
},
session: async ({ session, token }) => {
if (session.user) {
session.user = {
...session.user,
...token,
};
}
return session;
},
},
providers: [], // Add providers with an empty array for now
trustHost: true,
} satisfies NextAuthConfig;Answered by Pink salmon
I think I was just missing an env variable https://next-auth.js.org/configuration/options#environment-variables
1 Reply
Pink salmonOP
I think I was just missing an env variable https://next-auth.js.org/configuration/options#environment-variables
Answer