Deprecate and replace createWorkersKVSessionStorage
#10151
aaronadamsCA
started this conversation in
Proposals
Replies: 2 comments 2 replies
-
You could replace it with D1 backed session storage, but there's no helper for that, you will need to use createSessionStorage to build one yourself. |
Beta Was this translation helpful? Give feedback.
1 reply
-
'Had thought through this consequence and accepted it since sessions are localized - reads and writes to a single session are through one POP (unless a user jumps via VPN or other). Would KV work under this constraint or still result in eventual consistency? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
createWorkersKVSessionStorage
is dangerous because Workers KV is only eventually consistent. I think it should be deprecated, or at least very clearly marked as unsuitable for production use.I learned this the very hard way today after a total authentication outage which turned out to be a result of a KV slowdown. Writes were taking several seconds to show up in subsequent reads, so there was a state mismatch on every single OAuth2 login callback.
We've worked around it for now by switching to cookie session storage, but that's not really a long term solution. I don't have an opinion yet on what to replace it with, I just wanted to get this reported ASAP.
Beta Was this translation helpful? Give feedback.
All reactions