Skip to content

v1.7.0 is not compatible with Next v14.x #101

@marvinbernd

Description

@marvinbernd

Versions

  • @prismicio/next: v.1.7.1
  • next: v14.2.3
  • node: v20.10.0

Reproduction

When trying to run local environemnt I get the follwoing error:
Uncaught (in promise) Error: draftMode was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context

Steps to Reproduce

  1. Set up a Next.js project with v14.2.3.
  2. Install @prismicio/next v1.7.0.
  3. Run the project and trigger a route.
  4. Observe the error in the console.

Expected Behavior

draftMode() should work as intended within the context of the request scope without throwing an error.

Actual Behavior

The error mentioned above is thrown, preventing the feature from functioning.

Possible Cause

The change on draftMode() from a sync to an async function in v1.7.0 is not compatible with Next v14.x

Workaround

Downgrading @prismicio/next to v1.6.x or an earlier compatible version resolves the issue.

Suggested Fix

v1.7.0 is a breaking change and should be a major version release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions