Skip to content

fix: cast expires_utc to TEXT for Node < 24.4 sqlite compatibility#83

Closed
swairshah wants to merge 1 commit intosteipete:mainfrom
swairshah:fix/node22-sqlite-bigint
Closed

fix: cast expires_utc to TEXT for Node < 24.4 sqlite compatibility#83
swairshah wants to merge 1 commit intosteipete:mainfrom
swairshah:fix/node22-sqlite-bigint

Conversation

@swairshah
Copy link
Contributor

Summary

  • Update sweet-cookie patch to cast expires_utc to TEXT when readBigInts is not supported
  • Prevents integer overflow errors on Node 22.x when reading Chrome cookies

Problem

On Node 22.x, bird fails with:

⚠️ node:sqlite failed reading Chrome cookies (requires modern Chromium, e.g. Chrome >= 100): The value of column 4 is too large to be represented as a JavaScript number: 13449186288000000
❌ Missing required credentials

Chrome stores cookie expiration timestamps as large integers that exceed Number.MAX_SAFE_INTEGER.

Solution

The readBigInts option for node:sqlite was only added in Node 24.4. This patch casts expires_utc to TEXT in the SQL query when running on Node < 24.4. The sweet-cookie code already handles parsing string values via tryParseInt().

Test plan

  • Tested on Node 22.15.1 with Chrome cookies
  • Verified bird whoami works after the fix

Fixes #82
Related: steipete/sweet-cookie#17

🤖 Generated with Claude Code

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>
@swairshah swairshah closed this Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chrome cookie extraction fails on Node 22 with integer overflow error

1 participant