fix: update transaction cookie deletion to clear all cookies on succe…#2464
fix: update transaction cookie deletion to clear all cookies on succe…#2464rajyan wants to merge 1 commit into
Conversation
|
Hey @rajyan — thank you for putting this together and for the thorough writeup. The root cause diagnosis is exactly right and this approach works for the common case. We're closing this in favour of a more targeted fix we're landing internally, wanted to explain why rather than just closing. Why
|
|
Thanks for the detailed explanation. The targeted approach makes sense and looks like the right fix! |
|
This: #2748 |
📋 Changes
This PR fixes the transaction cookie accumulation issue by calling
deleteAllinhandleCallbackupon successful authentication.Problem:
In v4, transaction cookies (
__txn_*) accumulate over time as users navigate the app while unauthenticated. This eventually causes 431 errors due to request header size limits.Solution:
handleCallbackto calltransactionStore.deleteAll()instead oftransactionStore.delete(state)after successful authenticationdeleteAllcall inhandleLogoutChanged files:
src/server/auth-client.ts: Replacedelete(state)withdeleteAll()inhandleCallbacksrc/server/redundant-txn-cookie-deletion.test.ts: Update test to verify all transaction cookies are deleted on success📎 References
deleteAlltohandleLogout🎯 Testing
Unit tests:
redundant-txn-cookie-deletion.test.tsto verify that all transaction cookies are deleted after successful callbackManual testing (verified locally):
__txn_*cookies)__txn_*cookies were cleared from the browser