#Vercel OG Image Generation

2 messages · Page 1 of 1 (latest)

spice gate
#

why does a serverless function in nextjs has a body in the http request but is null when the function is OG image generation?

import { ImageResponse } from "@vercel/og"
import { NextApiRequest, NextApiResponse } from 'next';

export const config = {
    runtime: 'experimental-edge',
};

export default function(req: NextApiRequest, res: NextApiResponse) {
    console.log(req.body); // <-- not logging the request body
    return (new ImageResponse(
        (<div>
            hi
        </div>),
            {
                width: 934,
                height: 282,
            }
        )
    );
}``` this prints null whereas ```ts
import type { NextApiRequest, NextApiResponse } from 'next'

type Data = {
  name: string
}

export default function handler(
  req: NextApiRequest,
  res: NextApiResponse<Data>
) {
  console.log(req.body); // <-- logging the request body here
  res.status(200).json({ name: 'Foo bar' })
}
``` shows the body
west urchin
#

are these endpoints requested in the same way?