Skip to content

TypeError: The "payload" argument must be of type object. Received null when using ImageResponse #76407

@github0013

Description

@github0013

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/typeerror-the-payload-argument-must-be-of-type-object-received-null-when-usi-pzgs64

To Reproduce

  1. Create the following file: /app/opengraph-image.tsx
import { ImageResponse } from "next/og";

export default async function Image() {
  return new ImageResponse(<div>{`aaa`} 🎉</div>, {
    width: 1200,
    height: 630,
  });
}
  1. Start the Next.js development server
  2. Access http://localhost:3000/opengraph-image in a browser.
  • It is worth to mention that when 🎉 is removed, it works without an error.

Current vs. Expected behavior

Current

⨯ [Error: TypeError: The "payload" argument must be of type object. Received null
at cloneSourceMapV3 (node:internal/source_map/source_map:365:3)
at new SourceMap (node:internal/source_map/source_map:145:21)
at findSourceMap (node:internal/source_map/source_map_cache:339:17)
at getSourcemappedFrameIfPossible (/app/node_modules/next/dist/server/patch-error-inspect.js:163:90)
at parseAndSourceMap (/app/node_modules/next/dist/server/patch-error-inspect.js:265:39)
at sourceMapError (/app/node_modules/next/dist/server/patch-error-inspect.js:288:22)
...
...

This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
] {
code: 'ERR_INTERNAL_ASSERTION',
page: '/opengraph-image'
}

Expected

The page shows aaa 🎉 as an image.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025
  Available memory (MB): 31902
  Available CPU cores: 8
Binaries:
  Node: 20.17.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.1.7 // Latest available version is detected (15.1.7).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Metadata, Dynamic Routes

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dynamic RoutesRelated to dynamic routes.MetadataRelated to Next.js' Metadata API.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions