CreateCatalogImage url not defined

I’m not sure what I’m doing wrong. I’m using pipedream to connect to the Square API and using node.js I have this code:

import { axios } from "@pipedream/platform";

export default defineComponent({
  props: {
    square: {
      type: "app",
      app: "square",
    }
  },
  async run({ steps, $ }) {
    const Cover = steps.trigger.event.fields.Cover[0];
    const imageUrl = Cover.url;
    const filename = Cover.filename;

    try {
      const id = await createCatalogImage(imageUrl, filename);
      console.log(`Created image with ID: ${id}`);
      return id;
    } catch (error) {
      console.log(error);
      throw Error(error);
    }
  }
});

async function createCatalogImage(imageUrl, filename) {
  try {
    const response = await axios(imageUrl, { responseType: 'blob' });
    const image = response.data;
    console.log(imageUrl);
    console.log(filename);
    let formData = new FormData();
    formData.append("image", image, filename);
    formData.append(
      "request",
      JSON.stringify({
        idempotency_key: "fegte-98475",
        is_primary: true,
        image: {
          type: "IMAGE",
          id: "#1",
          image_data: {
            name: filename,
            caption: filename,
          },
        },
      })
    );
    const createCatalogImgPath = `https://connect.squareup.com/v2/catalog/images`;
    const token = this.square.$auth.oauth_access_token;
    const newCatalogImage = await makeRequest(
      createCatalogImgPath,
      "POST",
      token,
      formData,
      {
        url: createCatalogImgPath,
        headers: {
          Authorization: `Bearer ${token}`,
        },
      }
    );

    return newCatalogImage.image.id;
  } catch (error) {
    console.log(error);
    throw Error(error);
  }
}

and I'm getting this error:

Error
Error: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined

What’s your application ID? :slightly_smiling_face:

sq0idp-Yrrrvui1jKbXT1NB5uizpQ

Just checking to see if anyone has a solution? Thanks!

Looking at the API Logs the error that you’re now getting is:

      "detail": "Received multiple request parts. Please only supply zero or one `parts` of type application/json or application/x-protobuf."

:slightly_smiling_face:

I guess this is over my head then. I thought I was only sending one part. And why does the error say it’s about the URL if it’s not about that?