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.22k stars 118 forks source link

[🐛 Bug]: "Invalid URL String" error #792

Open simmbiote opened 3 months ago

simmbiote commented 3 months ago

next-on-pages environment related information

System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103 CPU: (8) arm64 Apple M1 Memory: 8 GB Shell: /bin/zsh Package Manager Used: npm (10.2.4)

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

Description

On a very simple page at /, I get "Invalid URL String." error. Page exists at /src/app/page.tsx.

On debugging I found the error to come from the function applyRouteDest The cause seems to be the invalid path? //[...slugs]?nxtPslugs=en-ZA image

i18n is configured in next.config.js

const nextConfig = {
  i18n: {
    locales: ['en-ZA'],
    defaultLocale: 'en-ZA',
  },
....

Reproduction

Potentially, try set up internationalisation on a nextjs app:

  i18n: {
    locales: ['en-ZA'],
    defaultLocale: 'en-ZA',
  },

Pages Deployment Method

Pages CI (GitHub/GitLab integration)

Pages Deployment ID

37d9b237

Additional Information

No response

Would you like to help?

dario-piotrowicz commented 2 months ago

Thanks a lot for the issue (and PR!) @simmbiote 🙏 ❤️

(I'm so very sorry for the ultra late reply! 😢 🙇 😓 )

Could you maybe share the source code of your app? (so that I could more easily validate your solution?)