Skip to content

Draft Mode does not work on 16.2.0 and 16.2.1 #415

Description

@freekh

When trying to enable Val it fails with:

Error: `draftMode` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context

This seems like a Next.js specific issue. A new Next.js install on 16.2.1 will produce this error, on any route.js file in api like this:

// app/api/foo/route.js
import { draftMode } from "next/headers";

export async function GET() {
  const isDraftMode = await draftMode();
  return Response.json({ message: "Hello, world!" });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions