Hey all, I am trying to use @vercel/og without NextJS and I am following the Vercel docs. I am able to deploy successfully but when I visit the route /api/og, I get a 404 error. Also I just checked my deployment logs and the edge function is not getting detected as such. Any help will be appreciated!
Directory structure:
.
├── api
│ └── og.tsx
├── node_modules
│ ├── @types
│ ├── @vercel
│ │ └── og -> ../.pnpm/@[email protected]/node_modules/@vercel/og
│ └── typescript -> .pnpm/[email protected]/node_modules/typescript
├── package.json
├── pnpm-lock.yaml
└── tsconfig.json
Code:
// /api/og.tsx
import { ImageResponse } from '@vercel/og';
export const config = {
runtime: 'experimental-edge',
};
export default function () {
return new ImageResponse(
(
<div
style={{
fontSize: 128,
background: 'white',
width: '100%',
height: '100%',
display: 'flex',
textAlign: 'center',
alignItems: 'center',
justifyContent: 'center',
}}
>
Hello world!
</div>
),
{
width: 1200,
height: 600,
}
);
}