[PR #411] [MERGED] fix: handle single object for openGraph.images and twitter.images #551

Closed
opened 2026-05-06 13:08:43 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/411
Author: @jokull
Created: 3/10/2026
Status: Merged
Merged: 3/10/2026
Merged by: @james-elicx

Base: mainHead: fix/metadata-og-images-single-object


📝 Commits (3)

  • 1e3383a fix: handle single object for openGraph.images and twitter.images in metadata shim
  • 805cd04 Merge remote-tracking branch 'origin/main' into fix/metadata-og-images-single-object
  • e000fa6 fmt

📊 Changes

3 files changed (+68 additions, -5 deletions)

View changed files

📝 packages/vinext/src/shims/metadata.tsx (+17 -5)
tests/fixtures/app-basic/app/nextjs-compat/metadata-opengraph-single-image/page.tsx (+27 -0)
📝 tests/nextjs-compat/metadata.test.ts (+24 -0)

📄 Description

Summary

  • Fix "imgList is not iterable" crash when openGraph.images or twitter.images is a single object instead of an array
  • Next.js allows images to be a string, a single { url, width, height } object, or an array — the metadata shim only handled string and array, crashing on single objects
  • Update Metadata type definition to include single-object variants
  • Add test fixture and tests for the single-object case

Reproduction

Any page using generateMetadata() or export const metadata that returns openGraph.images as a single object (common when using libraries like react-datocms's toNextMetadata()) causes the worker to crash with:

Error: imgList is not iterable

Test plan

  • New test: "should render og:image when images is a single object"
  • New test: "should render og:image dimensions for single image object"
  • New test: "should render twitter:image when images is a single object"
  • Existing OG/Twitter metadata tests still pass

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/411 **Author:** [@jokull](https://github.com/jokull) **Created:** 3/10/2026 **Status:** ✅ Merged **Merged:** 3/10/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/metadata-og-images-single-object` --- ### 📝 Commits (3) - [`1e3383a`](https://github.com/cloudflare/vinext/commit/1e3383a8e5aaa442d14246622d631cf1427ce0f4) fix: handle single object for openGraph.images and twitter.images in metadata shim - [`805cd04`](https://github.com/cloudflare/vinext/commit/805cd04aefeae5618d2eeb670e265f5a10aaebba) Merge remote-tracking branch 'origin/main' into fix/metadata-og-images-single-object - [`e000fa6`](https://github.com/cloudflare/vinext/commit/e000fa62284218b60636e09beb331237be3b707d) fmt ### 📊 Changes **3 files changed** (+68 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/metadata.tsx` (+17 -5) ➕ `tests/fixtures/app-basic/app/nextjs-compat/metadata-opengraph-single-image/page.tsx` (+27 -0) 📝 `tests/nextjs-compat/metadata.test.ts` (+24 -0) </details> ### 📄 Description ## Summary - Fix "imgList is not iterable" crash when `openGraph.images` or `twitter.images` is a single object instead of an array - Next.js allows `images` to be a `string`, a single `{ url, width, height }` object, or an array — the metadata shim only handled string and array, crashing on single objects - Update `Metadata` type definition to include single-object variants - Add test fixture and tests for the single-object case ## Reproduction Any page using `generateMetadata()` or `export const metadata` that returns `openGraph.images` as a single object (common when using libraries like `react-datocms`'s `toNextMetadata()`) causes the worker to crash with: ``` Error: imgList is not iterable ``` ## Test plan - [ ] New test: "should render og:image when images is a single object" - [ ] New test: "should render og:image dimensions for single image object" - [ ] New test: "should render twitter:image when images is a single object" - [ ] Existing OG/Twitter metadata tests still pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:43 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#551
No description provided.