Closed tcikovsky closed 2 years ago
Hi @tcikovsky, I'm not immediately seeing anything here. Unfortunately, I'm on MacOS/Linux, so its hard to test if there may be something platform-specific going on... @wSedlacek, have you ever encountered anything like this before?
Unfortunately, I'm on MacOS/Linux, so its hard to test if there may be something platform-specific going on...
I daily drive macOS, so I am in the same boat.
@wSedlacek, have you ever encountered anything like this before?
I have not seen this specific error before, that said, I don't have any active projects that are making use this library.
also i had to add this fix because typescript wouldnt shut up about it:
Adding the type definitions for SessionData
is standard practice when using express-session
with TypeScript.
Nothing unusual there. Although I wouldn't have used any
, but that's just me.
I am just really confused as to what this means.
@tcikovsky it sounds like there is an update()
being called that does not meet the requirements of the prisma schema.
Can I see your prisma schema for Session
?
I just checked and it matches the one on the npm setup page but still here you go:
model Session {
id String @id
sid String @unique
data String
expiresAt DateTime
}
🤔 @tcikovsky Could you clone our repo and run the test under WSL to see if any of the test fail?
git clone git@github.com:kleydon/prisma-session-store.git
cd prisma-session-store
yarn
yarn test
@wSedlacek - Thanks for the help trying to diagnose this!
so the command you gave me didn't work but I still understood what you want me to do and so I cloned the repository and passed both tests.
@tcikovsky
🤔 Alright, so the next step will be to create a minimal recreation.
Can you create a repo with just express
, express-session
and prisma-session-store
that uses the same logic you posted for your /login
route?
Note: This is explicitly excluding next
to isolate variables.
Once you provide this repo I will be able to clone it and debug the issue further.
Specifically I am to figure out what data
and existingSession
are at run time when the issue is occurring.
https://github.com/kleydon/prisma-session-store/blob/b444380fc62398e51f17e5cbc480d2e069908937/src/lib/prisma-session-store.ts#L380-L385
I did notice that you have a res.send()
and a req.session.reload()
outside of the callback of the req.session.save()
I am curious if there is some strangeness caused by the order of operations of those calls.
will do but those commands are there just because i was trying them when debugging the issue. i think the error predates that code.
@tcikovsky Were you still having issues?
Closing this for now; we can re-open if concerns re-surface.
Hi, I'm seeing a similar error on macOS
touch(): Error:
Invalid `this.prisma.session.update()` invocation in
.../@quixo3/prisma-session-store/dist/lib/prisma-session-store.js:526:66
523 existingSession = _b.sent();
524 if (!(existingSession !== null)) return [3 /*break*/, 5];
525 existingSessionData = __assign(__assign({}, this.serializer.parse((_a = existingSession.data) !== null && _a !== void 0 ? _a : '{}')), { cookie: session.cookie });
→ 526 return [4 /*yield*/, this.prisma.session.update(
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: ConnectionError(Timed out during query execution.) })
Error:
Invalid `this.prisma.session.update()` invocation in
node_modules/@quixo3/prisma-session-store/dist/lib/prisma-session-store.js:526:66
523 existingSession = _b.sent();
524 if (!(existingSession !== null)) return [3 /*break*/, 5];
525 existingSessionData = __assign(__assign({}, this.serializer.parse((_a = existingSession.data) !== null && _a !== void 0 ? _a : '{}')), { cookie: session.cookie });
→ 526 return [4 /*yield*/, this.prisma.session.update(
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: ConnectionError(Timed out during query execution.) })
at cb /node_modules/@prisma/client/runtime/index.js:38687:17)
I'm running the prisma session store v3.0.1 Prisma v3.6.0 Node v14.16.0
and using a sqlite database.
Never mind, the stack trace I just shared is likely related to https://github.com/prisma/prisma/issues/9562 (which is unrelated to this session-store package). @tcikovsky yours didn't include the same key phrase I've seen (error occurred during query execution
), but are you using sqlite?
I am on a WSL (Windows 10) machine and I am running nextjs with express and prisma for the backend. I am getting a error that I think is something inside the code from this package:
I am just really confused as to what this means. I have had this issue for about 3 months now and though this may just be me being dumb I can't seem to figure out what is wrong with it, and it seems no one else had a similar issue.
here is my code:
initializing the middleware (sidenote: makeSecretSession just generates a random string):
logging-in path middleware (req.session.userId = user.id should be the issue i think):
also i had to add this fix because typescript wouldnt shut up about it: