next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

getDraftData prevents SSG due to cookies usage

Open ksk1kd opened this issue 8 months ago • 0 comments

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

ksk1kd avatar May 12 '25 14:05 ksk1kd