X
Xata•2w ago
mrcentigrade

@auth/xata-adapter issue.

i've a sveltekit app (svelte 4) and i am using authjs (nextauth) to implement google signin. signout / signout works. however i've noticed that updateSession doesn't work. i spent some time and bumped my authjs related packages to the latest i.e. @auth/core@latest @auth/sveltekit@latest @auth/xata-adapter@latest. my session config is as follows:
session: {
strategy: 'database',
// Session will be valid for 24 hours
maxAge: 30 * 24 * 60 * 60, // 30 days in seconds
// Update session every 4 hours if user is active
updateAge: 24 * 60 * 60, // 24 hours in seconds
// Generate new session ID on every update
generateSessionToken: () => crypto.randomUUID()
},
session: {
strategy: 'database',
// Session will be valid for 24 hours
maxAge: 30 * 24 * 60 * 60, // 30 days in seconds
// Update session every 4 hours if user is active
updateAge: 24 * 60 * 60, // 24 hours in seconds
// Generate new session ID on every update
generateSessionToken: () => crypto.randomUUID()
},
when i console log the nextauth_session record i get the following output:
{
// ...
"xata_createdat": null,
"xata_id": null,
"xata_updatedat": null,
"xata_version": null,
"xata": {
"createdAt": "2025-01-22T07:33:36.971Z",
"updatedAt": "2025-01-22T07:33:36.971Z",
"version": 0
}
}
{
// ...
"xata_createdat": null,
"xata_id": null,
"xata_updatedat": null,
"xata_version": null,
"xata": {
"createdAt": "2025-01-22T07:33:36.971Z",
"updatedAt": "2025-01-22T07:33:36.971Z",
"version": 0
}
}
the adapter is looking for the flat xata_* fields, but they're nested in the xata object. so i have to manually clear my cookies and signin again. is there any way to get around this?
3 Replies
cmck
cmck•2w ago
Hi @mrcentigrade sorry for the delay, I'll take a look at this now and see if I can find a solution. Thanks for your patience.
mrcentigrade
mrcentigradeOP•2w ago
thanks for getting back @cmck ! i ended up writing my own updateSession in the meantime 🙂 does xata allow contributions? i'll have happy to do a PR. please let me know.
cmck
cmck•7d ago
That's great to hear, glad you were able to find a fix. Xata does not allow contributions at the moment but I will bring this to the team's attention and see if they can make a similar fix. Thanks again!

Did you find this page helpful?