Using createImageEdit in Node JS with a buffer string

Hello All,

Having a lot of issues trying to create an image edit using openai in Node.'/edit-image', async(req, res) => {
  openai = await getAPIKey()
  const prompt = req.body.prompt;
  const resolution = req.body.resolution;
  const num = req.body.num
  const mainBufferString = req.body.main;
  const mainBuffer = Buffer.from(mainBufferString, 'base64');
  try {
    originalImageBuffer = await sharp(mainBuffer)
    .resize({ height: 512, width: 512 })
    .toBuffer(); = 'something.png'
  let response = await openai.createImageEdit(
  } catch (error) {
    console.log("Error Occurred");

The code I am using is shown here. I am passing the same image which has been resized and made into a png buffer (since I want to do this in memory), but I keep getting a very non descriptive 400 error.

Has anyone had any experience trying to pass a buffer into the imageEdit API in node? Is this possible? I got it to work with a readstream before but doing it in memory is more ideal as this app will eventually be hosted in a backend on GCP

By the way I also validated other variables like prompt, num, and resolution, so that is definitely not the issue.