500 Error - Error: ENOENT: no such file or directory on Dynamic Next.js Pages
Bug report
Description / Observed Behavior
When visiting a [slug] which is dynamically generated (dynamicParams=true) @vercel/og throws error because of this noto-sans font. I'm not even using that font.
Error: ENOENT: no such file or directory, open '/vercel/path0/node_modules/.pnpm/@[email protected]/node_modules/@vercel/og/dist/noto-sans-v27-latin-regular.ttf'
at Object.openSync (node:fs:601:3)
at Object.readFileSync (node:fs:469:35)
at 6919 (/var/task/.next/server/chunks/547.js:25185:48)
at __webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42)
at 6536 (/var/task/.next/server/app/(website)/post/[slug]/page.js:374:18)
at Function.__webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42)
at async tree.children.children.children.children.children.metadata.openGraph (/var/task/.next/server/app/(website)/post/[slug]/page.js:237:36)
at async /var/task/node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/lib/metadata/resolve-metadata.js:188:102
at async Promise.all (index 0)
at async collectStaticImagesFiles (/var/task/node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/lib/metadata/resolve-metadata.js:189:80) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/vercel/path0/node_modules/.pnpm/@[email protected]/node_modules/@vercel/og/dist/noto-sans-v27-latin-regular.ttf'
}
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
digest: '2402302127'
}
Error: ENOENT: no such file or directory, open '/vercel/path0/node_modules/.pnpm/@[email protected]/node_modules/@vercel/og/dist/noto-sans-v27-latin-regular.ttf'
at Object.openSync (node:fs:601:3)
at Object.readFileSync (node:fs:469:35)
at 6919 (/var/task/.next/server/chunks/547.js:25185:48)
at __webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42)
at 6536 (/var/task/.next/server/app/(website)/post/[slug]/page.js:374:18)
at Function.__webpack_require__ (/var/task/.next/server/webpack-runtime.js:25:42)
at async tree.children.children.children.children.children.metadata.openGraph (/var/task/.next/server/app/(website)/post/[slug]/page.js:237:36)
at async /var/task/node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/lib/metadata/resolve-metadata.js:188:102
at async Promise.all (index 0)
at async collectStaticImagesFiles (/var/task/node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/lib/metadata/resolve-metadata.js:189:80) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/vercel/path0/node_modules/.pnpm/@[email protected]/node_modules/@vercel/og/dist/noto-sans-v27-latin-regular.ttf',
page: '/post/two'
}
RequestId: 23f56f00-cb6b-43cb-b1fb-86896b71b79e Error: Runtime exited with error: exit status 1
Runtime.ExitError
Expected Behavior
It should not throw the font error for dynamic params true, the page should load normally.
Reproduction
Static URL (works): https://next-font-bug-surjithctly.vercel.app/post/one Dynamic URL (throws error): https://next-font-bug-surjithctly.vercel.app/post/two
Github Source: https://github.com/surjithctly/next-og-bug
Additional Context
@vercel/og with Next.js /app repo
@shuding since there are many issues related to @vercl/og, maybe it's time to move it to this repo and make this repo a monorepo
@Jackie1210 yep I was busy with recent new features in Next.js and will start doing that next week!