I am using Auth0 with a NextJS app hosted in Google Cloud. My middleware file currently looks like this:
import { withMiddlewareAuthRequired } from “@auth0/nextjs-auth0/edge”;
import { NextResponse } from “next/server”;
import type { NextRequest } from “next/server”;export default withMiddlewareAuthRequired({
async middleware(req: NextRequest) {
const response = NextResponse.next();response.headers.set("X-Content-Type-Options", "nosniff"); return response;
},
});
When running it locally, I am asked to login once the first time I visit the page, then not asked again unless I log out. However, when using the version in Google Cloud Run, I am asked to login again every time I refresh the page or am loading a page that triggers a server action that sends a request to an API I am yet to contact in this session. Essentially, it has to log in again every time I refresh or contact a new API, but this does not happen locally. Are there any specific configuration issues within Auth0 related to Google Cloud and/or NextJS I might have missed?