vercel / vercel/flags

Problems with opengraph-image when using precompute

Open
#191 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
622
Forks
87
Avg merge
1d 11h
Merged PRs (30d)
14

Description

The pattern described for the middleware in the docs https://flags-sdk.dev/frameworks/next/precompute#2-precompute-flags-in-middleware breaks opengraph-image URL generation.

Basically, the URL generated by Next for opengraph-image already includes the JWT flags because it uses the rewritten URL, but the middleware adds the JWT flag again to the URL, which makes the route not match to anything.

Repro: https://github.com/matixlol/next-flags-sdk-bug-repro

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documented precompute middleware pattern at flags-sdk.dev/frameworks/next/precompute#2-precompute-flags-in-middleware and reproduce the failure using the linked next-flags-sdk-bug-repro. Trace opengraph-image URL generation and the middleware rewrite to identify the duplicated JWT flag; done means the generated route matches successfully with a single JWT flag.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.