Hi again. I have implemented an auth flow with exp...
# support-questions-legacy
s
Hi again. I have implemented an auth flow with expressjs server + react native on localhost, ngrok and Hasura before. It was working great. Today I have switched to a vercel app following the example here https://github.com/supertokens/supertokens-auth-react/blob/master/examples/with-emailpassword-vercel/api/index.js. Again everything works fine except SuperTokens.getAccessTokenPayloadSecurely()).jwt. When I try to get the JWT it returns
Could not refresh session
error.
You can see the session init here. JWT is enabled and issuer is set to vercel auth path. I would really appreciate any ideas.
r
Can you enable debug logs on the backend and then query that? And show me the Log output
See the troubleshooting section on how to enable debug logs
s
I can pass DEBUG=com.supertokens arg when running vercel on localhost like
DEBUG=com.supertokens vercel dev
but not sure how to achieve that with vercel deploys. I have tried adding
"vercel-build": "DEBUG=com.supertokens node ./api/index.js"
to package json but even though I can see the logs the build never gets completed.
With localhost
vercel dev
everything works perfect though. I can get the JWT with
(await SuperTokens.getAccessTokenPayloadSecurely()).jwt
without any issues.
r
Hmmm
What is the appInfo that you have configured on the backend and frontend? During production deployment
s
My frontend app info:
Copy code
SuperTokens.init({
    apiDomain: https://akasa-audiobook-auth-server-offminded.vercel.app,
    apiBasePath: '/api/auth'
});
Backend app info:
Copy code
appInfo: {
      appName: my-project-audiobook,
      apiDomain: https://akasa-audiobook-auth-server-offminded.vercel.app,
      websiteDomain: https://akasa-audiobook-auth-server-offminded.vercel.app,
      apiBasePath: '/api/auth',
      websiteBasePath: '/auth',
    },
r
When you query doesSessionExist on the frontend, does it work correctly?
Does doing an API call that requires session verification work correctly?
s
Yes.
Yeah, seems to be working. DoesSessionExist returns true and right after that I try to get jwt and it fails.
r
Hmm. That’s really strange.
Can you delete the sAccessToken cookie and then make an API call that requires a session?
Does it refresh the session automatically?
s
Let me try that
Ok I have tried and my vercel backend does not seem to be able to refresh session properly.
I have given up trying with vercel and moved my backend to Heroku. All working fine with it.
It might be something to do with vercel node runtime config. Memory or max duration might be the factor here not sure.
r
Hmm. We have tried to deploy app with vercel and it works all fine. But if you got it to work in heroku, then I guess that’s good enough!