Custom Auth0 SDK Instance using withPageAuthRequired


I am created my own instance of auth0 sdk like this :

// utils/auth0.js
import { initAuth0 } from "@auth0/nextjs-auth0";
import {
  withPageAuthRequired as withPageAuthRequiredOrig,
  getAccessToken as getAccessTokenOrig,
  withApiAuthRequired as withApiAuthRequiredOrig,
} from "@auth0/nextjs-auth0";

const auth0 = initAuth0({
  secret: "mysecret",
  issuerBaseURL: "",
  baseURL: "http://localhost:3000",
  clientID: "myid",

// Add withPageAuthRequired to your custom auth0 instance
auth0.withPageAuthRequired = withPageAuthRequiredOrig.bind(auth0);

export default auth0;

However , I can’t use my own instance with initAuth0 and named exports. The reason is that I can’t make aws amplify work with enviromental variables so I need to have my own instance since I can’t configure the dynamic one.

Can anyone help me on how to set this up ? Thank you !