Next.js Discord

Discord Forum

use draftMode inside generateStaticParams

Unanswered
Paul posted this in #help-forum
Open in Discord
Hi, I'm trying to use the draftMode (https://nextjs.org/docs/app/building-your-application/configuring/draft-mode) inside generateStaticParams (https://nextjs.org/docs/app/api-reference/functions/generate-static-params)

But this seems to fail with the following error
Error: Invariant: draftMode() expects to have requestAsyncStorage, none available.


Is there an alternative to do this? I'm trying to get all the static paths for my blog posts in sanity

1 Reply

NOTE: I'm using the exact same draftMode inside the default export for the page and it works, it just gives that error as soon as I try in the generateStaticParams