Skip to content

[BUG] SearchParams with the same key are not parsed into a string array #537

@ilovemesomeramen

Description

@ilovemesomeramen

Describe the bug

NextJs supports multiple search params with the same key which are parsed into a string array, e.g.

?foo=bar&foo=bar2 = {foo: ['bar', 'bar2']}

in the opennext runtime following query parameters will result in

?foo=bar&foo=bar2 = {foo: 'bar2'}

Steps to reproduce

Create a new Page:

export default async function Page({
  searchParams,
}: {
  searchParams: Promise<{ [key: string]: string | string[] }>;
}) {
  const sParams = await searchParams;

  return (
    <div>
      {Object.entries(sParams).map(([k, v]) => {
        return <p>{`${k}: ${v}`}</p>;
      })}
    </div>
  );
}

go to the page with the same query key twice in the URL such as ?foo=bar&foo=bar2 once in the normal next server and once using wrangler and you will see the difference

Expected behavior

multiple query parameters of with the same key should be parsed into a string array as well.

@opennextjs/cloudflare version

1.0.0-beta.0

Wrangler version

4.7.2

next info output

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Mon, 24 Mar 2025 06:33:36 +0000
  Available memory (MB): 63483
  Available CPU cores: 16
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: N/A
  pnpm: 10.7.0
Relevant Packages:
  next: 15.2.4 // Latest available version is detected (15.2.4).
  eslint-config-next: 15.2.4
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.7.2
Next.js Config:
  output: N/A

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions