database connection doesn't work in / behave strangely in global context.
this doesn't work
this however does work fine.
both work fine in lambdas.
what's happening ?
6 Replies
Workers does not allow I/O in global contexts. I would recommend doing something like the following if you must use global contexts:
this unfortunately doesn't work either.
it's weird, cuz one request works & the 2nd one doesn't...
Yeah, I would recommend just not using the global scope then
While the above suggestion might work, it appears that Kysely may attempt to keep the connection open across multiple requests, which afaik doesn't work
I looked into hyperdrive ( still don't understand it fully .. )
do you think this is performant enough ?
That looks fine?
I think so, I am new to this TBH. I am still learning.
I change it to this