Next.js go back browser button doesn't work - client stops responding

genai_worksPRO

a year ago

Hello

I have moved my Next.js project from Vercel to Railway and I have noticed an issue. Everything works well, unless you click on go back button in the browser. Then application stops responsonding, you don't go back, and you can't even reload the page. Is this something I can configure not to happen? Maybe some timeout setting?

Our website: https://genai.works/

Solved

5 Replies

a year ago

Is there anything in the deployment logs or browser console logs?


genai_worksPRO

a year ago

```
⨯ Error: The router state header was sent but could not be parsed.

at /app/nodemodules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:14296 at rD (/app/nodemodules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:14365)
at /app/nodemodules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:25097 at AsyncLocalStorage.run (node:asynchooks:338:14)
at Object.wrap (/app/nodemodules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:16241) at /app/nodemodules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24987
at AsyncLocalStorage.run (node:asynchooks:338:14) at Object.wrap (/app/nodemodules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:15489)
at rB (/app/nodemodules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24914) at r7.render (/app/nodemodules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:28962)
```


genai_worksPRO

a year ago

After investigation, it happens only with home page. And it can happen not only when going back\forward, but also with usual navigation via links.

Checking further


genai_worksPRO

a year ago

I will keep struggling and share details as soon as I fix this issue. From my understanding it's connected to undocumented next.js behavior related to caching system or\and to server\client components division.


genai_worksPRO

a year ago

So the reason was Lottie animation

Solution:

before:
in Lottie component
animationData={lottie}

after:
animationData={JSON.parse(JSON.stringify(lottie))}

just some weird bug of Lottie (lottie-react npm package)


Status changed to Solved railway[bot] 12 months ago


Next.js go back browser button doesn't work - client stops responding - Railway Help Station