NlaakALDOriginal post
Rank 2: Process
Next.js 14.2.3 & node-appwrite 12.1.0-rc.4
The [https://appwrite.io/docs/tutorials/nextjs-ssr-auth/] example does not work. The session is empty. So after redirecting to account (profile) page no session. console shows something, but no session.
Bash
Submitted with FormData { '$ACTION_ID_34da0b0f339b64faae9cd17956855b7c6670dbdf': '', email: 'n*******d@gmail.com', password: '***********'}Signing in with nlaakald@gmail.com **********Done! Session is { '$id': '665776d61c9073aae9ae', '$createdAt': '2024-05-29T18:41:26.131+00:00', '$updatedAt': '2024-05-29T18:41:26.131+00:00', userId: '6632b5ae003b1e166738', expire: '2025-05-29T18:41:26.117+00:00', provider: 'email', providerUid: 'n*******d@gmail.com', providerAccessToken: '', providerAccessTokenExpiry: '', providerRefreshToken: '', ip: '172.*.*.*', osCode: 'LIN', osName: 'GNU/Linux', osVersion: '', clientType: '', clientCode: '', clientName: '', clientVersion: '', clientEngine: '', clientEngineVersion: '', deviceName: 'desktop', deviceBrand: '', deviceModel: '', countryCode: 'us', countryName: 'United States', current: true, factors: [ 'password' ], secret: '', mfaUpdatedAt: ''}Cookie is { name: 'my-app-session', value: '', path: '/', httpOnly: true, sameSite: 'strict', secure: true}Getting logged in user...Error getting logged in user Error: No session at createSessionClient (webpack-internal:///(rsc)/./lib/appwrite.ts:30:15) at getLoggedInUser (webpack-internal:///(rsc)/./lib/appwrite.ts:58:35) at Profile (webpack-internal:///(rsc)/./app/auth/profile/page.tsx:30:86)Console
Bash
BROWSER AND DEVICE SESSION LOCATION IP on GNU/Linux United States 172.*.*.*Code is @ https://github.com/AndrewDonelson/next-appwrite-starter/tree/convert-node-appwrite
Summary
Developers experiencing an issue where the session is empty after signing in should ensure the API key is valid and has the session write scope. The provided example for Next.js 14.2.3 & node-appwrite 12.1.0-rc.4 does not work as expected.
Solution: Double check the API key for the correct configuration and session write scope.