Skip to content

Optimize OG Image Error #184

@xingfanxia

Description

@xingfanxia

Describe the bug

Build Error On Vercel with NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTO_OG_IMAGES = 1 with R2 Storage, this error doesn't trigger with
NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTOS = 1

Error occurred prerendering page "/p/Hc2J6Cyt/image". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Image size cannot be determined. Please provide the width and height of the image.
    at In (file:///vercel/path0/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:15354:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at process.processTimers (node:internal/timers:516:9)
    at async Wt (file:///vercel/path0/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:16119:16)
    at async Wt (file:///vercel/path0/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:16127:22)
    at async Wt (file:///vercel/path0/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:16127:22)
    at async Wt (file:///vercel/path0/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:16103:42)
    at async Wt (file:///vercel/path0/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:16127:22)
    at async Wt (file:///vercel/path0/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/@vercel/og/index.node.js:16103:42)
Export encountered an error on /p/[photoId]/image/route: /p/Hc2J6Cyt/image, exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null
 ELIFECYCLE  Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions