next.js icon indicating copy to clipboard operation
next.js copied to clipboard

OpenGraph ImageResponse doesn't render UTF-8 characters properly

Open MartinXPN opened this issue 1 year ago • 2 comments

Link to the code that reproduces this issue

https://github.com/MartinXPN/next-image-response-reproduction

To Reproduce

  1. Run the project with npm run dev
  2. Open the browser and go to http://localhost:3000
  3. Open the generated opengraph path
  4. See that the image is not generated properly

Current vs. Expected behavior

The image should contain the text Բարև ձեզ. Instead, it only contains empty rectangles. See below.

opengraph-image

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020
  Available memory (MB): 65536
  Available CPU cores: 12
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: 14.2.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: N/A

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

Not sure, Metadata

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

next dev (local), next start (local), Vercel (Deployed)

Additional context

As an additional request, it would be great to be able to load the fonts like in a regular NextJS app (where all the google fonts are available):

import {Roboto} from "next/font/google";

const font = Roboto({weight: ['300', '400', '500', '700'], subsets: ['latin']});

Instead of having to store the fonts locally and load the font manually like this:

const interSemiBold = fetch(
        new URL('./Inter-SemiBold.ttf', import.meta.url)
    ).then((res) => res.arrayBuffer())

MartinXPN avatar Jun 05 '24 07:06 MartinXPN

This issue has been automatically marked as stale due to inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.

nextjs-bot avatar Dec 02 '25 23:12 nextjs-bot

Yeah, it's still relevant. It was not resolved yet.

MartinXPN avatar Dec 03 '25 06:12 MartinXPN

I can reproduce this. I’ll investigate and try to submit a PR. I’ll post findings here

Artur-Sahakyan avatar Dec 17 '25 12:12 Artur-Sahakyan