Description
Environment
vercel-edge
Reproduction
Reproduction repo: https://github.com/ericfennis/nitro-vercel-og
Fork this repo and deploy it to Vercel to see in the logs that the function is crashed.
Describe the bug
@vercel/og together with Nitro is not working on the Vercel Edge environment dispite that config preset is set to vercel-edge
.
Probably this is same issue on other worker environments.
Note: If your run the reproduction repo it is working locally.
Additional context
I deployed the reproduction repo on vercel: https://nitro-vercel-og.vercel.app/
Digging deeper into this I found out that the wrong entry file is included in the build.
fs
is only include in the node entry file in the exports
of the package.json. So I think if the Nitro preset is set to vercel-edge
, netlify-edge
or cloudflare
. The package resolver should use worker
or edge
export in a package.json export.
The vercel OG package.json
{
"name": "@vercel/og",
"version": "0.5.11",
"description": "Generate Open Graph Images dynamically from HTML/CSS without a browser",
"type": "module",
"main": "./dist/index.node.js",
"types": "./dist/index.node.d.ts",
"files": [
"dist/**/*"
],
"exports": {
".": {
"edge": {
"types": "./dist/index.edge.d.ts",
"default": "./dist/index.edge.js"
},
"edge-light": {
"types": "./dist/index.edge.d.ts",
"default": "./dist/index.edge.js"
},
"browser": {
"types": "./dist/index.edge.d.ts",
"default": "./dist/index.edge.js"
},
"worker": {
"types": "./dist/index.edge.d.ts",
"default": "./dist/index.edge.js"
},
"workerd": {
"types": "./dist/index.edge.d.ts",
"default": "./dist/index.edge.js"
},
"import": {
"types": "./dist/index.node.d.ts",
"default": "./dist/index.node.js"
},
"node": {
"types": "./dist/index.node.d.ts",
"default": "./dist/index.node.js"
},
"default": "./dist/index.node.js"
},
"./package.json": "./package.json"
},
Logs
No response