When missing AUTH_URL, should error be being thrown or warning printed? #10375
vanviethieuanh
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
When missing AUTH_URL (or NEXTAUTH_URL) I expected an error to be thrown or a warning printed.
Non-Goals
No response
Background
I'm using Svelte Kit now and when I set up Authjs like this without config
AUTH_URL
norNEXTAUTH_URL
at all:everything works fine when I run it with
yarn run dev
. However, when I runyarn run build && yarn run preview
an error happened (I consider it an error but it is not logging nor throwing any error so if it is not then it is not 🥲).When I ran the built version, I logged in successfully, the token is sitting in my cookies (which is good). However, this code on the client side (a
+page.svelte
file) returns theuser
asundefined
:this also happened on server-side files, for example,
session
on this+page.server.js
file isnull
:The problem here is my users were logged in successfully. If something is missing, an error should be thrown, so I can tell my users we have a problem. Or at least somehow, I would know why the token is in my cookies but my session is
null
. However, no error was thrown nor warning was printed.Proposal
I suggest we throw an error similar to
MissingSecret
or at least print a warning when the session token is received but something is wrong and cannot get the session.A supper thank you to all of you who contributed to this repository!
Beta Was this translation helpful? Give feedback.
All reactions