nuxt-auth: I cannot run build and still make auth0 work

Environment

  • Operating System: Darwin
  • Node Version: v16.15.1
  • Nuxt Version: 3.1.1
  • Nitro Version: 2.1.1
  • Package Manager: npm@8.11.0
  • Builder: vite
  • User Config: css, app, runtimeConfig, modules, i18n, algolia, image, auth
  • Runtime Modules: @nuxtjs/tailwindcss@6.2.0, @nuxtjs/i18n@8.0.0-beta.4-27816734.493bb8f, @nuxtjs/algolia@1.2.0, nuxt-lodash@2.4.1, @sidebase/nuxt-auth@0.4.1
  • Build Modules: -

Reproduction

setup auth0 as a provider npm run build node .output/server/index.mjs

Describe the bug

In dev everything works fine, but when i run npm run build and then run de node server it does not work.

Additional context

nuxt.config.js

auth: {
      origin: 'http://localhost:3000'
  }

[…].ts

providers: [
        // @ts-ignore
        Auth0Provider.default({
            clientId: config.NUXT_AUTH0_CLIENT_ID,
            clientSecret: config.NUXT_AUTH0_CLIENT_SECRET,
            issuer: config.NUXT_AUTH0_ISSUER
        })
    ]

has secret added

Logs

[next-auth][error][SIGNIN_OAUTH_ERROR] 
https://next-auth.js.org/errors#signin_oauth_error only valid absolute URLs can be requested {
  error: {
    message: 'only valid absolute URLs can be requested',
    stack: 'TypeError: only valid absolute URLs can be requested\n' +
      '    at Function.request (/Users/raducretu/Work/adn-storefront/.output/server/node_modules/openid-client/lib/helpers/request.js:68:11)\n' +
      '    at Function.discover (/Users/raducretu/Work/adn-storefront/.output/server/node_modules/openid-client/lib/issuer.js:144:38)\n' +
      '    at openidClient (/Users/raducretu/Work/adn-storefront/.output/server/node_modules/next-auth/core/lib/oauth/client.js:16:41)\n' +
      '    at getAuthorizationUrl (/Users/raducretu/Work/adn-storefront/.output/server/node_modules/next-auth/core/lib/oauth/authorization-url.js:70:49)\n' +
      '    at Object.signin (/Users/raducretu/Work/adn-storefront/.output/server/node_modules/next-auth/core/routes/signin.js:38:60)\n' +
      '    at AuthHandler (/Users/raducretu/Work/adn-storefront/.output/server/node_modules/next-auth/core/index.js:253:39)\n' +
      '    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n' +
      '    at async file:///Users/raducretu/Work/adn-storefront/.output/server/chunks/nitro/node-server.mjs:430:24\n' +
      '    at async Object.handler (file:///Users/raducretu/Work/adn-storefront/.output/server/node_modules/h3/dist/index.mjs:840:19)\n' +
      '    at async Server.toNodeHandle (file:///Users/raducretu/Work/adn-storefront/.output/server/node_modules/h3/dist/index.mjs:915:7)',
    name: 'TypeError'
  },
  providerId: 'auth0',
  message: 'only valid absolute URLs can be requested'
}

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

@zoey-kaiser Sure you can! I also just renamed a couple of env vars so that its easier to diff between auth0-specific and nuxt-auth. 😀