https://supertokens.com/ logo
#general
Title
# general
r

Rob Schilder

07/18/2022, 12:50 PM
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

rp

07/18/2022, 12:51 PM
Can you enable frontend and backend debug logs please and show the output of that?
Whilst the refreshing is failing
r

Rob Schilder

07/18/2022, 12:52 PM
Yeah first I'd like to know how to 'simulate' a refresh
r

rp

07/18/2022, 12:53 PM
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

Rob Schilder

07/18/2022, 12:53 PM
thanks
in vercel
I will now make a new prod build with
Copy code
supertokens.init({
    enableDebugLogs: true,
because that was off
r

rp

07/18/2022, 1:01 PM
i see.
r

Rob Schilder

07/18/2022, 1:02 PM
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

rp

07/18/2022, 1:04 PM
.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

Rob Schilder

07/18/2022, 1:06 PM
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

rp

07/18/2022, 1:06 PM
hmm. I would need to see the logs and the browser console to be able to help
r

Rob Schilder

07/18/2022, 1:25 PM
now its an infinite loop of this
in production with
Copy code
enableDebugLogs: true,
this is from when
init
is called
r

rp

07/18/2022, 1:35 PM
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

rp

07/18/2022, 2:37 PM
Before calling supertoeks.init on the backend API routes, you can set the prcess env like how I said above
r

Rob Schilder

07/22/2022, 9:03 AM
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

rp

07/22/2022, 9:14 AM
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
3 Views