NuxtN
Nuxt5mo ago
8 replies
Cândido Silva

NuxtAuth sidebase return 404 on /session

Hello
I am trying to deploy on netlify a nuxt auth using sidebase(auth.sidebase.io) but it return page not found: /session 404

the baseURL is setting to "/" even if I put the correct AUTH_ORIGIN as you can see on my nuxt.config below

 auth: {
    isEnabled: true,
    origin: process.env.AUTH_ORIGIN || "http://localhost:3000",
    disableServerSideAuth: false,
    originEnvKey: "AUTH_ORIGIN",
    baseURL: process.env.URL ? `${process.env.URL}/api/auth` : undefined,
    provider: {
      type: "authjs",
    },
    enableGlobalAppMiddleware: true,
  },

I tried to show the URL env value on runtimeConfig and it show the correct info but for some reason the baseURL is changing when I deploy as you can see below

console.log(runtimeConfig)
{
  "public": {
    "URL": "https://nuxt-auth-cs.netlify.app",
    "DEPLOY_URL": "https://68cc0a3cc566ba000884265f--nuxt-auth-cs.netlify.app",
    "AUTH_ORIGIN": "https://nuxt-auth-cs.netlify.app",
    "secret": "your-secret-here",
    "githubClientId": "Ov23liWA39hBirkhfdyl",
    "githubClientSecret": "a109cf0fab4567b4673178e23333e8435eaced44",
    "auth": {
      "isEnabled": true,
      "baseURL": "/",
      "disableInternalRouting": false,
      "disableServerSideAuth": false,
      "originEnvKey": "AUTH_ORIGIN",
      "sessionRefresh": {
        "enablePeriodically": false,
        "enableOnWindowFocus": true,
        "handler": ""
      },
      "globalAppMiddleware": {
        "isEnabled": false,
        "allow404WithoutAuth": true,
        "addDefaultCallbackUrl": true
      },
      "origin": "https://nuxt-auth-cs.netlify.app",
      "provider": {
        "type": "authjs",
        "trustHost": false,
        "defaultProvider": "",
        "addDefaultCallbackUrl": true
      },
      "enableGlobalAppMiddleware": true
    }
  },
  "app": {
    "baseURL": "/",
    "buildId": "128fe6ce-f5e6-4815-bd19-0a7d0f34dce0",
    "buildAssetsDir": "/_nuxt/",
    "cdnURL": ""
  }
}
page.png
Was this page helpful?