Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

message: 'Invalid URL', on v 0.10.0 #970

Open
agracia-foticos opened this issue Dec 23, 2024 · 4 comments
Open

message: 'Invalid URL', on v 0.10.0 #970

agracia-foticos opened this issue Dec 23, 2024 · 4 comments
Labels
bug A bug that needs to be resolved pending An issue waiting for triage

Comments

@agracia-foticos
Copy link

Environment

  • Operating System: Linux
  • Node Version: v22.8.0
  • Nuxt Version: 3.14.1592
  • CLI Version: 3.17.1
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

i have this config:

 auth: {        
     // @ts-ignore (isEnabled boolean type)
     //BE CAREFULL, With visual studio debugger isEnabled can't be false, fails... issue opened
     isEnabled                         : true, //all environment variables are strings
     baseURL                           : `${process.env.NUXT_BASE_URL}/api/auth`, // The origin is set to the development origin. Change this when deploying to production by setting `origin` in this config before build-time or by exporting `AUTH_ORIGIN` by running `export AUTH_ORIGIN=...`                  
     // Whether to add a global authentication middleware that will protect all pages without exclusion
     globalAppMiddleware : true,
     provider                          : { type: 'authjs' },
     sessionRefresh : {
        enablePeriodically              : 86400000, //refresh the session every day
        enableOnWindowFocus             : true
     }
 },
  1. go to localhost:3000
  2. Server responses with error 500 and
error {
  url: '/',
  statusCode: 500,
  statusMessage: '',
  message: 'Invalid URL',
  stack: '<pre><span class="stack internal">at new URL (node:internal/url:816:29)</span>\n' +
    '<span class="stack internal">at /home/web/var/www/site/node_modules/@sidebase/nuxt-auth/dist/runtime/composables/authjs/utils/navigateToAuthPage.js:15:31</span>\n' +
    '<span class="stack internal">at runNextTicks (node:internal/process/task_queues:65:5)</span>\n' +
    '<span class="stack internal">at process.processImmediate (node:internal/timers:459:9)</span>\n' +
    '<span class="stack internal">at process.callbackTrampoline (node:internal/async_hooks:130:17)</span>\n' +
    '<span class="stack internal">at async Object.callAsync (/home/web/var/www/site/node_modules/unctx/dist/index.mjs:72:16)</span>\n' +
    '<span class="stack internal">at async Object.callAsync (/home/web/var/www/site/node_modules/unctx/dist/index.mjs:72:16)</span>\n' +
    '<span class="stack internal">at async /home/web/var/www/site/node_modules/nuxt/dist/pages/runtime/plugins/router.js:180:26</span></pre>'
}
3. Automatic, (without any action), redirects to http://localhost:3000/login?callbackUrl=http://localhost:3000/


If i turn globalAppMiddleware to false, works OK

Describe the bug

i have this config:

 auth: {        
     // @ts-ignore (isEnabled boolean type)
     //BE CAREFULL, With visual studio debugger isEnabled can't be false, fails... issue opened
     isEnabled                         : true, //all environment variables are strings
     baseURL                           : `${process.env.NUXT_BASE_URL}/api/auth`, // The origin is set to the development origin. Change this when deploying to production by setting `origin` in this config before build-time or by exporting `AUTH_ORIGIN` by running `export AUTH_ORIGIN=...`                  
     // Whether to add a global authentication middleware that will protect all pages without exclusion
     globalAppMiddleware : true,
     provider                          : { type: 'authjs' },
     sessionRefresh : {
        enablePeriodically              : 86400000, //refresh the session every day
        enableOnWindowFocus             : true
     }
 },
  1. go to localhost:3000
  2. Server responses with error 500 and
error {
  url: '/',
  statusCode: 500,
  statusMessage: '',
  message: 'Invalid URL',
  stack: '<pre><span class="stack internal">at new URL (node:internal/url:816:29)</span>\n' +
    '<span class="stack internal">at /home/web/var/www/site/node_modules/@sidebase/nuxt-auth/dist/runtime/composables/authjs/utils/navigateToAuthPage.js:15:31</span>\n' +
    '<span class="stack internal">at runNextTicks (node:internal/process/task_queues:65:5)</span>\n' +
    '<span class="stack internal">at process.processImmediate (node:internal/timers:459:9)</span>\n' +
    '<span class="stack internal">at process.callbackTrampoline (node:internal/async_hooks:130:17)</span>\n' +
    '<span class="stack internal">at async Object.callAsync (/home/web/var/www/site/node_modules/unctx/dist/index.mjs:72:16)</span>\n' +
    '<span class="stack internal">at async Object.callAsync (/home/web/var/www/site/node_modules/unctx/dist/index.mjs:72:16)</span>\n' +
    '<span class="stack internal">at async /home/web/var/www/site/node_modules/nuxt/dist/pages/runtime/plugins/router.js:180:26</span></pre>'
}
3. Automatic, (without any action), redirects to http://localhost:3000/login?callbackUrl=http://localhost:3000/


If i turn globalAppMiddleware to false, works OK

Additional context

No response

Logs

No response

@agracia-foticos agracia-foticos added bug A bug that needs to be resolved pending An issue waiting for triage labels Dec 23, 2024
@phoenix-ru
Copy link
Collaborator

Hi @agracia-foticos , thanks a lot for your report about v0.10! This data is valuable as there were lots of breaking changes and internal refactoring.
As our company is on a vacation, we could only get back to Sidebase work in the first/second week of January 2025.
Sorry for a wait

@phoenix-ru
Copy link
Collaborator

Also beware that there are breaking changes exactly regarding the URL logic. You may need to follow the release notes for that: https://auth.sidebase.io/upgrade/version-0.10.0

@agracia-foticos
Copy link
Author

Actually, I think I have done the migration correctly, since if I disable the globalAppMiddleware I can log in and out without problems.
But when i put globalAppMiddleware to true, the first page its a 500 error (the trace of error its in this page)and automatically redirects me correctly to login page

@agracia-foticos
Copy link
Author

i upgrade from "@sidebase/nuxt-auth": "0.9.4",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved pending An issue waiting for triage
Projects
None yet
Development

No branches or pull requests

2 participants