Skip step with error

Hello, is there any way to skip a step with error?

Example, I have a step that uploads an image to imgbb.com but the site is currently offline. I wanted to continue with the flow even with an error in this step.

1 Like

Hello @hgrams,

Unfortunately for now Pipedream has not offer this capability yet. I think what we can do to workaround is using the Node.js/Python Code step to do the same task, and catch the error if it occur in the code step. You can refer to Pipedream’s open source repository for the action Node.js code if needed

I’ll keep monitoring this to see if there’s much needs for this feature to be requested!

2 Likes

Thanks for the answer.

When I put the imgbb upload NodeJS code, I get error. I believe it’s because of " import app from “…/…/imgbb.app.mjs” "

How do I import imgbb.app.mjs in my node.js code?

Hello @hgrams,

I think you can change it to

import app from '@pipedream/imgbb'

Preferably, you can use the imgbb API directly using these options

1 Like

Thanks!!

Hello, I’m trying to use the imgbb API directly with the available codes, but I’m not able to add an upload option.

Would you help me?

import { axios } from "@pipedream/platform"
export default defineComponent({
  props: {
    imgbb: {
      type: "app",
      app: "imgbb",
    },
    filePath: {
      type: "string",
      label: "File Path",
      description: "The path to the file saved to the [`/tmp`directory](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory)(e.g. `/tmp/image.png`). Must specify either **File URL** or **File Path**.",
      optional: true,
    },
  },
  async run({steps, $}) {
    return await axios($, {
      method: "post",
      url: `https://api.imgbb.com/1/upload`,
      params: {
        key: `${this.imgbb.$auth.api_key}`,
        image: `R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,
        name: ``,
      },
    })
    if (this.filePath) {
      this.fileData = (await fs.promises.readFile(this.filePath, {
        encoding: "base64",
      }));
    }
    const data = {
      image: this.fileUrl ?? this.fileData,
      name: this.name,
    };
    const res = await this.app.uploadPicture($, stringify(data));
    $.export("$summary", "Successfully uploaded picture");
    return res;
  },
})

Hi @hgrams

I think you can change the part this.app.uploadPicture(...) into this.imgbb.uploadPicture(...)

You can refer to this doc to understand how Pipedream’s app prop works: Component API Reference