Skip to content

getDraftData prevents SSG due to cookies usage #852

Description

@ksk1kd

Package containing the bug

next-drupal (NPM package)

Describe the bug

When using getDraftData, the following error occurs during build time, preventing SSG:

Error: Dynamic server usage: Route /[...slug] couldn't be rendered statically because it used `cookies`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error

Expected behavior

No errors should occur during build time, and SSG should function properly.

Steps to reproduce:

  1. Create a project with the basic starter
    https://github.com/chapter-three/next-drupal/tree/basic-starter%402.0.0/starters/basic-starter
  2. Add console.log(error) to the catch block in the code at the link below
    https://github.com/chapter-three/next-drupal/blob/next-drupal%402.0.0/starters/basic-starter/app/%5B...slug%5D/page.tsx#L127
  3. Run the build
  4. The error can be confirmed in the console

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageA new issue that needs triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions