gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.13k stars 10.33k forks source link

Gatsby serve SSR does not resolve encoded url and throws error #39010

Open emkeythekeyem opened 3 weeks ago

emkeythekeyem commented 3 weeks ago

Preliminary Checks

Description

When serving a Gatsby site with server-side rendering (SSR), encoded URLs are not correctly translated, resulting in a 500 internal server error.

TypeError: Cannot destructure property 'params' of '(0 , _reachRouter.match)(...)' as it is null.

Reproduction Link

CODESANDBOX

Steps to Reproduce

  1. bottom terminal do a yarn build and then a yarn serve
  2. right page go to APP-LINK/ and it shows the console log and it's working, now go to https://yrg5ww-9000.csb.app/test-d%27alviano and it shows my error
Screenshot 2024-06-06 at 13 06 48 Screenshot 2024-06-06 at 13 06 58

Expected Result

Translating the url and showing the exact thing is showing with the decoded url, this does not happen if i am not using gatsby serve & ssr.

Actual Result

TypeError: Cannot destructure property 'params' of '(0 , _reachRouter.match)(...)' as it is null.

Environment

System:
    OS: Linux 6.1 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (2) x64 AMD EPYC
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 20.12.1 - /tmp/yarn--1717672196079-0.3539445966095174/node
    Yarn: 1.22.19 - /tmp/yarn--1717672196079-0.3539445966095174/yarn
    npm: 10.5.0 - /home/codespace/nvm/current/bin/npm
  Languages:
    Python: 3.10.13 - /home/codespace/.python/current/bin/python
  npmPackages:
    gatsby: ^5.13.5 => 5.13.5

Config Flags

DEV_SSR: true