Skip to content

Bug: Infinite redirect on revalidation Β #1467

@wottpal

Description

@wottpal

Description

Hey, there I wanted to share a reproduction of an issue that caused me several hours of debugging in the last days to locate. (I found it finally) πŸ˜΅β€πŸ’«

These are the changes I made from next-intl/examples/example-app-router/examples:

  1. Updating dependencies & to Next.js 15 (incl. async params, etc.). Don't know if this is v15-specific, just wanted to have the same environment as on in my project where the issue occured. Btw feel free to use this commit to upgrade the example for everyone.
  2. Adding an /api/revalidate route that basically only calls revalidatePath('/[locale]', 'page') (same issue with revalidatePath('/de'))
  3. Adding the bug reproduction in this commit:
    • Add export const dynamicParams = false in [locale]/layout.tsx (as all locales are statically known upfront)
    • Adding a return redirect('/') in the global not-found.tsx file (as that's the desired behavior for my app)

I now removed dynamicParams = false in my project. If it's generally advised against having it, I would suggest adding this to the docs!

Verifications

Mandatory reproduction URL

https://github.com/wottpal/next-intl-revalidation-bug-repro

Reproduction description

bun install
bun run build
NEXT_PRIVATE_DEBUG_CACHE=1 bun run start

# In a different terminal
curl -X POST http://localhost:3000/api/revalidate

Now open http://localhost:3000/de and you'll see an indefinite redirect occur.

Expected behaviour

Just loading the page as normal with an invalidated cache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingunconfirmedNeeds triage.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions