Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ilovemesomeramen opened this issue Apr 7, 2025 · 4 comments
Labels
bug Something isn't working waiting for feedback

Comments

@ilovemesomeramen
Copy link

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

@ilovemesomeramen ilovemesomeramen added bug Something isn't working triage labels Apr 7, 2025
@vicb
Copy link
Contributor

vicb commented Apr 7, 2025

I can not reproduce with 1.0.0-beta.0.
If you still have the error, please paste a link to a minimal repro in a GH repository

@vicb vicb closed this as completed Apr 7, 2025
@ilovemesomeramen
Copy link
Author

ilovemesomeramen commented Apr 7, 2025

@vicb Here you can find a minimal reproducible example.
After further digging it appears to be related to the next-intl middleware which appears to be treated differently in when being compiled with wrangler.

removing the intlMiddleware call in the middleware makes it work.

tested with v3 and v4 of next-intl the issue remains

@vicb
Copy link
Contributor

vicb commented Apr 14, 2025

@ilovemesomeramen could you please check the latest release 1.0.0-beta.3 works for you?

@ilovemesomeramen
Copy link
Author

the issue still remains.

I updated the min example with the new version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for feedback
Development

No branches or pull requests

2 participants