next.js: Prefetching failed to fetch RSC payload

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 19.8.1
      npm: 9.6.4
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 13.3.1-canary.17
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://github.com/somersby10ml/next-url-test/tree/reproduction-template-app-dir

To Reproduce

  1. Please run the yarn dev command to start the local development server.
  2. Press the F12 key to open the Developer Tools and navigate to the http://localhost:3000 URL.
  3. Click on the search button.
    • After moving, don’t hover your mouse over the Home or Search buttons.
  4. Click on either the move1 or move2 button.
  5. Hover over either the Home or Search element.

or

  1. Navigate to http://localhost:3000/search?name=ㄱㄴㄷㄹ in your web browser.
  2. Hover over either the Home or Search element.

Describe the Bug

  • An error occurs if you use a non-English string in the URL.

console.error

Failed to fetch RSC payload. Falling back to browser navigation. TypeError: Failed to execute 'fetch' on 'Window': Failed to read the 'headers' property from 'RequestInit': String contains non ISO-8859-1 code point.

🔽 console.error

a

🔽 when an error occurs.

b

🔽 header not giving error

c

🔽 header giving error

d

Expected Behavior

console.error not showing

Which browser are you using? (if relevant)

Chrome(112.0.5615.138) FireFox(112.0.1 64Bit)

How are you deploying your application? (if relevant)

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 25
  • Comments: 17 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Hi I have a similar problem. I get this error when trying to login into my nextJS app on Safari using supabase authentication.

Screenshot 2023-05-15 at 16 03 45

any solution?

when I add

export const dynamic = 'force-dynamic';

to all page.tsx

and add prefetch={false} to <Link

The error never appears.

This will likely be fixed in this pull request. https://github.com/vercel/next.js/pull/53073

Same error. I use cyrillic in url parameter for search. This bug is weird.

Workaround is to twice decodeURIComponent and encodeURIComponent

In my case, I simply disabled the prefetch flag of the Link component because I think it doesn’t make any improvement if it’s prefetched or not. You should consider if it’s necessary to prefetch a link, not worth it to turn it on all the time.

// I'm using Auth0, this is the link to log in, it'll be redirected to auth0 so it doesn't matter if it's not prefetched
<Link prefetch={false} href="api/auth/login">Login</Link>

I got this issue as well. I am using Clerk as the auth provider.

MacOS Chrome: just works out of the box iPhone Chrome: does not work. Same error as above