Skip to content

Add more details to the errors #13234

@Nefcanto

Description

@Nefcanto

Environment

  System:
    OS: Linux 6.14 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (4) x64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
    Memory: 4.97 GB / 15.53 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 22.19.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 11.6.0 - /usr/local/bin/npm
  npmPackages:
    @auth/qwik: ^0.8.0 => 0.8.0 

Reproduction URL

https://github.com/Nefcanto/TailwindReloadLoop

Describe the issue

I get this error:

[auth][error] TypeError: Invalid URL
    at new URL (node:internal/url:825:25)
    at getAuthorizationUrl (file:///npm/node_modules/@auth/core/lib/actions/signin/authorization-url.js:17:24)
    at Module.signIn (file:///npm/node_modules/@auth/core/lib/actions/signin/index.js:10:62)
    at AuthInternal (file:///npm/node_modules/@auth/core/lib/index.js:62:38)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Auth (file:///npm/node_modules/@auth/core/index.js:111:34)
    at async authAction (/npm/node_modules/@auth/qwik/index.qwik.js:397:17)
    at async Object.QwikAuthQrl_useSignIn_globalAction_xjVnyrcqS90 (/npm/node_modules/@auth/qwik/index.qwik.js:293:18)
    at async Object.qrl2 (/npm/node_modules/@builder.io/qwik/dist/core.mjs:7394:20)
    at async measure (file:///npm/node_modules/@builder.io/qwik-city/lib/vite/index.mjs:26557:12)

As you can see, the message does not tell us the URL it tries to use. It just says invalid URL.
Printing the invalid URL it received helps us in debugging the problem.

How to reproduce

  • Create an @auth/core project.
  • Pass an invalid URL.
  • You should see this error.

Expected behavior

It's more helpful to print the invalid URL. Something like:

[auth][error] TypeError: Invalid URL (the URL is: https://signin/redirectTo=home)
    at new URL (node:internal/url:825:25)
    at getAuthorizationUrl (file:///npm/node_modules/@auth/core/lib/actions/signin/authorization-url.js:17:24)
    at Module.signIn (file:///npm/node_modules/@auth/core/lib/actions/signin/index.js:10:62)
    at AuthInternal (file:///npm/node_modules/@auth/core/lib/index.js:62:38)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Auth (file:///npm/node_modules/@auth/core/index.js:111:34)
    at async authAction (/npm/node_modules/@auth/qwik/index.qwik.js:397:17)
    at async Object.QwikAuthQrl_useSignIn_globalAction_xjVnyrcqS90 (/npm/node_modules/@auth/qwik/index.qwik.js:293:18)
    at async Object.qrl2 (/npm/node_modules/@builder.io/qwik/dist/core.mjs:7394:20)
    at async measure (file:///npm/node_modules/@builder.io/qwik-city/lib/vite/index.mjs:26557:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions