Hi guys, I am the colleague of Edwin at de Lokalis...
# general
r
Hi guys, I am the colleague of Edwin at de Lokalist, as he is on holiday, I am inheriting our production codebase with Supertokens configured. We are having an error on our Dashboard which is mostly internally used , the error being:
("Could not refresh session");
What would be the best way to debug this?
r
Can you enable frontend and backend debug logs please and show the output of that?
Whilst the refreshing is failing
r
Yeah first I'd like to know how to 'simulate' a refresh
r
navigate to the API domain on your browser -> inspect element -> go to cookie section -> delete sAccessToken cookie
Then go back to your website domain and make an API call that requires session verification
r
thanks
in vercel
I will now make a new prod build with
Copy code
supertokens.init({
    enableDebugLogs: true,
because that was off
r
i see.
r
Recently my colleague changed the cookieDomain
Copy code
cookieDomain: process.env.NODE_ENV === 'production' ? '.lokalist.nl' : `.localhost`,
maybe that has an effect on it?
r
.localhost
is not a valid value for cookieDomain. Make it like this instead:
Copy code
cookieDomain: process.env.NODE_ENV === 'production' ? '.lokalist.nl' : undefined,
r
I will, however, in this case we were in production so then it was
'.lokalist.nl'
. Is there some CORS thing that I have to add?
or should changing it to this already affect it? Let me try
r
hmm. I would need to see the logs and the browser console to be able to help
r
now its an infinite loop of this
in production with
Copy code
enableDebugLogs: true,
this is from when
init
is called
r
Can I see the backend logs?
What are the logs value right after this?
Ok cool. Need to see backend logs now
You need to pass an env var.
process.env.DEBUG=com.supertokens
Yeah I am here yet fail to realize how I would do this for NextJS / Vercel in production
r
Before calling supertoeks.init on the backend API routes, you can set the prcess env like how I said above
r
So the problem is with the
access_token
refreshing. It is every hour, but there's a mistake here. How do I simulate this with Passwordless authentication?
r
well, you can login as usual, and then go to the cookie store (of your API domain), and delete the sAccessToken cookie. Then just call an API that requires session verification and it should attempt a refresh
6 Views