Skip to content

fix(router): support BigInt in query parameters#89213

Merged
bgw merged 1 commit intovercel:canaryfrom
jaffarkeikei:fix/stringifyUrlQueryParam-bigint
Jan 30, 2026
Merged

fix(router): support BigInt in query parameters#89213
bgw merged 1 commit intovercel:canaryfrom
jaffarkeikei:fix/stringifyUrlQueryParam-bigint

Conversation

@jaffarkeikei
Copy link
Copy Markdown

What changed?
stringifyUrlQueryParam now handles bigint type properly.

Why?
BigInt is a valid JavaScript primitive but was being converted to empty string:

Before:

stringifyUrlQueryParam(123n) // '' ❌

After:

stringifyUrlQueryParam(123n) // '123' ✓

Use case:
Query parameters with large integers (IDs, timestamps) often use BigInt to avoid precision loss.

Testing
Manual testing with BigInt values.

@nextjs-bot
Copy link
Copy Markdown
Collaborator

nextjs-bot commented Jan 29, 2026

Allow CI Workflow Run

  • approve CI run for commit: fa34376

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@nextjs-bot
Copy link
Copy Markdown
Collaborator

nextjs-bot commented Jan 29, 2026

Tests Passed

@bgw bgw enabled auto-merge (squash) January 30, 2026 00:07
@bgw bgw merged commit a1e9589 into vercel:canary Jan 30, 2026
316 of 330 checks passed
@bgw
Copy link
Copy Markdown
Member

bgw commented Jan 30, 2026

Thanks, @jaffarkeikei

@eps1lon
Copy link
Copy Markdown
Member

eps1lon commented Jan 30, 2026

We reverted this in #89283

This was missing the deserialization part which has security (DoS) implications: Deserializing BigInts needs to be limited since unreasonably large numbers (500+ digits) take a lot of blocking CPU time (upwards of 50ms).

If people really want to put BigInt into their search params, they can call .toString themselves and deserialize it. But since this makes a DDoS pretty trivial, we don't want to encourage BigInt for search params unless Next.js can make deserialization safe.

@jaffarkeikei jaffarkeikei deleted the fix/stringifyUrlQueryParam-bigint branch January 30, 2026 13:02
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants