Skip to content

Docs: #70305

Answered by AAorris
Tigatok asked this question in Help
Docs: #70305
Sep 20, 2024 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @Tigatok, thanks for trying out the Flags SDK. 🙇

The issue here is likely a mismatch between the key of your flags in the .well-known route and your flag definition:

// flag.ts
export const myFlag = flag({
  key: 'my-flag', // <-- Key is provided as "my-flag"
  decide: () => false,
  description: 'My Flag',
  origin: 'https://example.com/#new-feature',
}

// .well-known/vercel/flags/route.ts
return NextResponse.json<ApiData>({
  definitions: {
    myFlag: {  // <-- Key is provided as "myFlag"
      description: 'My Flag',
      origin: 'https://example.com/#new-feature',
      options: [
        { value: false, label: 'Off' },
        { value: true, label: 'On' },
      ],
    },
  },
})

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@adg29
Comment options

Answer selected by Tigatok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
Documentation Related to Next.js' official documentation.
4 participants
Converted from issue

This discussion was converted from issue #70299 on September 20, 2024 23:20.