Skip to content

fix: pass query params to OG image ISR function on Vercel#2432

Open
Adebesin-Cell wants to merge 2 commits intonpmx-dev:mainfrom
Adebesin-Cell:fix/og-image-pass-query
Open

fix: pass query params to OG image ISR function on Vercel#2432
Adebesin-Cell wants to merge 2 commits intonpmx-dev:mainfrom
Adebesin-Cell:fix/og-image-pass-query

Conversation

@Adebesin-Cell
Copy link
Copy Markdown
Contributor

Summary

  • Adds passQuery: true to the /__og-image__/** ISR route rule
  • Vercel's ISR passQuery defaults to false, which strips all query parameters before passing the request to the serverless function
  • This caused the compare page OG image to always render the empty state because the function never received packages=zustand,redux or the _query parameter that nuxt-og-image relies on

Root cause

Vercel's prerender config has a passQuery option that defaults to false. Without it, the ISR function receives the request with query params stripped — so the OG image handler always fetched /compare (no packages) instead of /compare?packages=zustand,redux.

Test plan

  • Deploy preview and verify OG image at /compare?packages=zustand,redux
  • Check /__og-image__/image/compare/og.html?packages=zustand,redux&_query=%7B%22packages%22:%22zustand,redux%22%7D shows package names
  • Verify other OG images (package pages, homepage) still work

Closes #2431

Vercel's ISR `passQuery` defaults to `false`, which strips all query
parameters before passing the request to the serverless function.
This caused the compare page OG image to always render the empty state
because the function never received `packages=zustand,redux` or the
`_query` parameter that nuxt-og-image relies on.

Closes npmx-dev#2431

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Apr 9, 2026 7:15am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Apr 9, 2026 7:15am
npmx-lunaria Ignored Ignored Apr 9, 2026 7:15am

Request Review

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 69d40bef-ea12-4387-940d-385ef221e5e6

📥 Commits

Reviewing files that changed from the base of the PR and between 8a53564 and b828bce.

📒 Files selected for processing (1)
  • nuxt.config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • nuxt.config.ts

📝 Walkthrough

Walkthrough

The Nuxt routeRules for the '/__og-image__/**' pattern in nuxt.config.ts was changed from using getISRConfig(3600) to an explicit inline object setting isr.expiration: 3600, enabling passQuery: true, and restricting allowed query parameters to ['packages', '_query']. No exported or public signatures were modified.

Possibly related PRs

  • PR #2277: Introduced the Compare OG image feature which relies on packages being passed via query parameters to the /__og-image__/** route.
  • PR #2298: Previously modified the same '/__og-image__/**' routeRules entry, changing ISR-related settings that this PR further adjusts.
  • PR #962: Earlier change to the '/__og-image__/**' routeRules ISR configuration, affecting OG image caching behaviour.

Suggested reviewers

  • alexdln
  • danielroe
  • graphieros
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description clearly explains the issue, root cause, and solution related to the Nuxt route rules configuration change.
Linked Issues check ✅ Passed The PR directly addresses issue #2431 by adding passQuery: true to enable query parameter pass-through to the OG image ISR function.
Out of Scope Changes check ✅ Passed All changes are focused on fixing the OG image ISR route rules configuration; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
nuxt.config.ts (1)

132-135: Add query parameter whitelist to explicitly constrain OG image cache variation

passQuery: true correctly makes query parameters available to the OG image handler. However, to ensure robust caching behaviour and prevent unintended cache fragmentation, explicitly specify which query parameters should affect the cache key using allowQuery. By default, query parameters are ignored for cache keying unless listed in allowQuery, so adding this constraint makes the caching intent clear and ensures only the parameters the handler actually needs will vary the cache.

Suggested hardening
     '/__og-image__/**': {
       isr: {
         expiration: 3600,
         passQuery: true,
+        allowQuery: ['packages', '_query'],
       },
     },

Verify which query parameters the OG image handler requires and update the allowQuery list accordingly.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 75e4234e-1b2b-4471-b88e-8e6e9a91ef32

📥 Commits

Reviewing files that changed from the base of the PR and between 57687cc and 8a53564.

📒 Files selected for processing (1)
  • nuxt.config.ts

Restrict cache variation to only the query params the OG handler needs,
preventing cache fragmentation from arbitrary query params.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@graphieros graphieros added the needs review This PR is waiting for a review from a maintainer label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review This PR is waiting for a review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compare page OG image renders empty state on production

2 participants