-
Notifications
You must be signed in to change notification settings - Fork 332
Closed
Description
Bug report
Description / Observed Behavior
When importing the @vercel/og module, an error occurs during the module's initialization in a GitHub Actions environment. The error appears to be related to converting a file path to a URL for the bundled font file (noto-sans-v27-latin-regular.ttf). This issue does not occur on my Japanese Windows machine but consistently reproduces on GitHub Actions using various Node.js versions (e.g., lts/-1, lts/*, latest).
The error log includes the following message:
TypeError: Invalid URL
at new URL (node:internal/url:806:29)
at fileURLToPath (node:internal/url:1485:12)
at file:///D:/a/satiri-test/satiri-test/node_modules/@vercel/og/dist/index.node.js:18929:32
...
input: '.\\file:\\D:\\a\\satiri-test\\satiri-test\\node_modules\\@vercel/og\\dist\\noto-sans-v27-latin-regular.ttf'
Expected Behavior
I expect @vercel/og to correctly resolve and load its assets (like fonts) without errors, regardless of the environment. The module should work seamlessly both locally and in CI environments such as GitHub Actions.
Reproduction
The issue can be reproduced with the following code:
import fs from "node:fs/promises";
import { ImageResponse } from "@vercel/og";
import component from "./component";
(async () => {
const response = new ImageResponse(component(), {
width: 800,
height: 600,
});
await fs.writeFile("out.png", Buffer.from(await response.arrayBuffer()));
})();To reproduce:
- Clone the repository: https://github.com/fa0311/satori-test
- Run the code with:
node --loader ts-node/esm src/main.ts
or
- Observe the error in the GitHub Actions logs: GitHub Actions Run
Additional Context
- @vercel/og version: 0.6.5
- React version: 19.0.0
- Node.js version: Tested with v20.18.2 and others
- Environment: The issue occurs in GitHub Actions (CI), while it does not on my local Japanese Windows environment.
- Additional Note: There is an experimental warning related to the
--experimental-loaderflag, and the error seems to be triggered during the import stage when resolving the font file URL.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels