How to resolve "this.fetch is not a function" error in Replicate API code?

This topic was automatically generated from Slack. You can find the original thread here.

Anyone here to help with Getting an error:
“this.fetch is not a function”

Code block here:

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

export default defineComponent({
  props: {
    replicateApiToken: {
      type: "string",
      label: "Replicate API Token",
      secret: true,
    },
    image: {
      type: "string",
      label: "Image",
    },
  },
  async run({ $ }) {
    const replicate = new Replicate({
      auth: this.replicateApiToken,
    });

    const output = await replicate.run(
      "yuval-alaluf/sam:9222a21c181b707209ef12b5e0d7e94c994b58f01c7b2fec075d2e892362f13c",
      {
        input: {
          image: this.image,
        },
      }
    );

    return output;
  },
});

Hi since you’re not explicitly calling this.fetch in your code, I strongly suspect it’s a problem with the underlying Replicate library. Please refer to their Github issue tracker, there might be a bug with the package.

Thanks for the prompt response Let me have a look. I was new to pipedream please :raised_hands::skin-tone-2: Excuse