n1ru4l
09/09/2022, 12:15 PM/api/auth/user/email/verify
raises the error Error: Unknown User ID provided
(and makes the app unusable).
Full Stack:
Error: Unknown User ID provided
at Recipe.<anonymous> (/app/node_modules/supertokens-node/lib/build/recipe/thirdpartyemailpassword/recipe.js:129:27)
at Generator.next (<anonymous>)
at fulfilled (/app/node_modules/supertokens-node/lib/build/recipe/thirdpartyemailpassword/recipe.js:15:36)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I think this is related due to an account that was deleted but the sAccessToken
, sFrontToken
, sIRTFrontend
and sIdRefreshToken
cookies still be present on the frontend 🤔
After deleting the cookies from the dev tools everything works fine!
Shouldn't the supertokens-auth-react
library handle this and auto logout the user/unset the cookies?
is this related to https://github.com/supertokens/supertokens-auth-react/issues/547 ?
Happy to open a new issue otherwise!n1ru4l
09/09/2022, 12:49 PM[object Object]
logs, we pinned it down to the following code within our Next.js application:
const { backendConfig } = await import('@/config/backend-config');
const SupertokensNode = await import('supertokens-node');
const Session = await import('supertokens-node/recipe/session');
SupertokensNode.init(backendConfig());
// this throws the error
const session = await Session.getSession(context.req, context.res, { sessionRequired: false });
After debugging the error and manually printing it this is the actual error:
SessionError {
type: 'TRY_REFRESH_TOKEN',
message: 'Access token has expired. Please call the refresh API',
payload: undefined,
errMagic: 'ndskajfasndlfkj435234krjdsa',
fromRecipe: 'session'
}
It seems like the error is not properly stringified (does not correctly extend/implement the Error class) as it seems to not pass the nextjs
isError
check?
Here is our debugging branch for figuring this out: https://github.com/kamilkisiela/graphql-hive/commit/63e66ab48335a3173d870c07a9510734b7f3c4af
Furthermore, as this appears over and over again we also believe that this error is not properly handled on the frontend (supertokens-auth-react
).
I assume that if this happens the session cookies should be unset.
Happy to open an issue on GitHub if there is no clear solution to this issue!rp
09/09/2022, 1:22 PMRoy R
09/09/2022, 9:05 PMViomenel
09/09/2022, 11:37 PMrp
09/10/2022, 4:11 AMJacobLUC
09/10/2022, 9:57 AMrp
09/10/2022, 11:07 AMflixoflax
09/10/2022, 11:42 AMrp
09/10/2022, 11:54 AMViomenel
09/10/2022, 12:16 PMrp
09/10/2022, 1:03 PMLuxaaa
09/11/2022, 10:23 AMpython
session = await get_session(request, session_required=True)
user_id = session.user_id
Because i need the user id for every request, this havely slows down my api calls.akns
09/11/2022, 4:05 PM/auth
Anything I can check?jg
09/11/2022, 4:38 PMnickm91
09/11/2022, 6:45 PMsIRTFrontend
sFrontToken
sIdRefreshToken
and sAccessToken
cookies and store them on the browser.
On prod a successful signup will only assign sIRTFrontend
and sFrontToken
In both cases the user is added to the db under the correct (emailpassword) recipe.
If I navigate to /auth
on prod, I'm still redirected to /
, so the EmailPasswordAuth
component is still detecting some sort of logged in session but the cookies are not present or working in the browser cookies nor being transferred with the request credentials. This all works on local.
I cannot for the life of me, figure out why the local implementation would be different?shorthair_[]
09/11/2022, 11:05 PMshorthair_[]
09/11/2022, 11:06 PMshorthair_[]
09/11/2022, 11:08 PMshorthair_[]
09/11/2022, 11:09 PMrp
09/12/2022, 3:53 AMBinouse
09/12/2022, 10:10 AMoutsparkled
09/12/2022, 2:10 PMrp
09/12/2022, 2:27 PMGreg
09/12/2022, 6:51 PMrp
09/12/2022, 7:37 PMsarahewarner
09/12/2022, 9:06 PMrp
09/13/2022, 4:37 AMidanh
09/13/2022, 7:16 AMrefreshSession: UNAUTHORISED because idRefreshToken from cookies is undefined
is there any workaround? i'm working on a responsive PWA with nestjs + graphql + Reactn1ru4l
09/13/2022, 9:05 AMsupertokens-node
verifySession
and Session.getSession
functions behave in case the session is expired? Do they check this? or will they return `null`/`undefined` in such an scenario?