Next.js Discord

Discord Forum

Feature flags / Next 15

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Avatar
Masai LionOP
Anyone else having issues with feature flags in Next 15? When I create a flag like the example from the documentation and import it into my page, I'm getting a server error. I couldn't replicate this in a brand new project with the same package versions so it's a bit weird.

## Flag

import { unstable_flag as flag } from '@vercel/flags/next';

export const showSummerSale = flag({
  key: 'summer-sale',
  decide: () => false,
  defaultValue: false
});


## Page
import { showSummerSale } from "../../lib/flags";

export default async function Page({}) {
  const sale = await showSummerSale();
  return <div>Hello World</div>;
}


## Error
[ Server ]  Error: Route "/test" used `cookies().get('vercel-flag-overrides')`. `cookies()` should be awaited before using its value. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis

3 Replies

Avatar
American black bear
New release of @vercel/flags going out later today that fixes this 🙌
Avatar
Lewis's Woodpecker
You can use this snapshot release in the meantime @vercel/flags@2.6.2-dcf54356-20241023094535 which is exactly the same as the latest release, but with Next.js 15 compatibility
Avatar
Lewis's Woodpecker
I just released v2.6.2 which has exactly the same changes as the snapshot release above, so upgrading to this version should eliminate all warnings 🙏