fix: cast expires_utc to TEXT for Node < 24.4 sqlite compatibility#83
Closed
swairshah wants to merge 1 commit intosteipete:mainfrom
Closed
fix: cast expires_utc to TEXT for Node < 24.4 sqlite compatibility#83swairshah wants to merge 1 commit intosteipete:mainfrom
swairshah wants to merge 1 commit intosteipete:mainfrom
Conversation
On Node 22.x, the node:sqlite module throws an error when encountering integers larger than Number.MAX_SAFE_INTEGER. Chrome stores cookie expiration timestamps (expires_utc) as large integers that exceed this limit. The readBigInts option that would handle this was only added in Node 24.4. This patch casts expires_utc to TEXT in the SQL query when running on Node < 24.4, which avoids the overflow error. The existing code already handles parsing string values via tryParseInt(). Fixes steipete#82 Related: steipete/sweet-cookie#16 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
expires_utcto TEXT whenreadBigIntsis not supportedProblem
On Node 22.x, bird fails with:
Chrome stores cookie expiration timestamps as large integers that exceed
Number.MAX_SAFE_INTEGER.Solution
The
readBigIntsoption fornode:sqlitewas only added in Node 24.4. This patch castsexpires_utcto TEXT in the SQL query when running on Node < 24.4. The sweet-cookie code already handles parsing string values viatryParseInt().Test plan
bird whoamiworks after the fixFixes #82
Related: steipete/sweet-cookie#17
🤖 Generated with Claude Code