Hello. Session verification during server side ren...
# support-questions-legacy
u
Hello. Session verification during server side rendering issue We have a nodejs server running supertokens node and our nextjs frontend using supertokens react. We use supertokens passwordless receipe for authentication, So far client side authentication has been working great. (Using latest versions of all SDK's) We followed this guide https://supertokens.com/docs/passwordless/nextjs/session-verification/in-ssr We have been adding support for SSR but running into some issues with accessing the session inside getServerSideProps. Locally it works, but when we deploy to AWS via sst opennext (https://docs.sst.dev/start/nextjs) we are getting this error.
Error getting session SessionError: Session does not exist. Are you sending the session tokens in the request with the appropriate token transfer method?
Turning on the debug config, we also get this error
com.supertokens {t: "2024-03-05T22:43:22.683Z", message: "getSession: UNAUTHORISED because accessToken in request is undefined",
One other line that jumps out is
message: "session init: cookieDomain: undefined", file: "/var/task/node_modules/supertokens-node/lib/build/recipe/session/recipe.js:173:18" sdkVer: "16.7.4"}
Logging the request, I can see the cookie is being set on the header. This is our nextjs backend config
Copy code
export const backendConfig = (): TypeInput => {
  return {
    appInfo: {
      appName: '**',
      apiDomain: '**',
      apiBasePath: '/auth',
      websiteDomain: '**',
    },
    framework: 'express',
    isInServerlessEnv: true,
    recipeList: [
      SessionNode.init(),
      PasswordlessNode.init({
        flowType: 'USER_INPUT_CODE',
        contactMethod: 'EMAIL_OR_PHONE',
      }),
    ],
    supertokens: {
      connectionURI: configLoader.get('SUPER_TOKENS_CONNECTION_URI'),
      apiKey: configLoader.get('SUPER_TOKENS_API_KEY'),
    },
    debug: true,
  }
}
Our authentication works fine still client side but having server side issues. Any help would be great.
4 Views