cloudflare / next-on-pages

CLI to build and develop Next.js apps for Cloudflare Pages
https://www.npmjs.com/package/@cloudflare/next-on-pages
MIT License
1.26k stars 122 forks source link

[🐛 Bug]: Next-International does not work deployed in Cloudflare #785

Open Eusebiotrigo opened 4 months ago

Eusebiotrigo commented 4 months ago

next-on-pages environment related information

System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 CPU: (8) arm64 Apple M1 Pro Memory: 32 GB Shell: /bin/zsh Package Manager Used: npm (10.7.0)

Relevant Packages: @cloudflare/next-on-pages: 1.11.3 vercel: N/A next: 14.2.3

Description

I've been trying to find a translation library that works in Cloudlfare Pages, and of course with NextJs. I have tried with next-international, next-intl and next-translate.

I will crosspost this from https://github.com/QuiiBz/next-international/issues/397

Here is a repository ( Eusebiotrigo/next-international-cloudflare ) to check the code and also a deployed version on Cloudflare: next-international-cloudflare.pages.dev.

In local, when changing languages, it changes the cookie Next-Locale, but it is not happening in the deployed version on Cloudflare.

The cookie change is handled through the middleware and it seems it is not executed on every request... but that's my wild guess.

I also have a thread in discord: https://discord.com/channels/595317990191398933/1232710382762852352

Reproduction

Here is a repository ( Eusebiotrigo/next-international-cloudflare ) to check the code and also a deployed version on Cloudflare: next-international-cloudflare.pages.dev.

Pages Deployment Method

Pages CI (GitHub/GitLab integration)

Pages Deployment ID

08977f40-ec55-4d02-9a39-a62219093f2e

Additional Information

Yeah, you should tell the team responsible of the dashboard to put an easy copy for the deployment id (I'm getting lazy with age).

Would you like to help?

Eusebiotrigo commented 4 months ago

I tried in Vercel and it works OK there. https://next-international-cloudflare.vercel.app/fr