Skip to content

Reader fails in Dynamic Route inside app router root directory on production #1333

@bastienrobert

Description

@bastienrobert

When trying to use the Keystatic reader to fetch content within a dynamic route under the app/ directory, the reader does not function as expected.
This issue occurs specifically when the route is dynamic ([slug], [id], etc.), and the Keystatic reader is called to fetch content dynamically based on the route parameters.

Steps to Reproduce:

  1. Set up a Next.js project using the app/ directory structure.
  2. Install and configure Keystatic to manage static content (e.g., Markdown files).
  3. Create a dynamic route, such as app/[slug]/page.tsx, and call the Keystatic reader inside it to fetch content based on the slug.
  4. Try accessing the route with different dynamic values (/post-1, /post-2, etc.).

REPO
https://github.com/bastienrobert/nextjs-keystatic-test-params-repro

Workaround:
Dynamic import using the standard import() method, put every mdx and markdoc inline and format files to JSON.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionShould probably be a discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions