Wondering if I made a mistake

I decided to take a dive today and upgrade my Pipedream to run some workflows for me. In the week leading up to todays purchase I was not sure and hovering between putting money in this or zapier. I am not a software developer at all.

I decided to go for pipedream because of Thomas Franks videos. I am using notion with chatgpt prompts.

The problem is, even in the week of testing, I would test a workflow in the editor and it would be fine. I would go and deploy it and test 3-4 workflows at a time - and half of them would not work. However - if I go back into the editor for the ones that showed an error, and retested the work flow - they would work. I refined and refined as much as I could the chatgpt prompts. Today - I chucked in 5 workflows and they worked - and then I decided to pay money and upgrade.

Now I went in and chucked in a whole bunch of requests and I get so many errors. Most of them are Error - Request failed with status code 500 or 503. Then if I go in and just run the workflow again from the editor they work. But before I do that I have to go back to notion - delete the half done work - and come back. Really annoying.

Is there any way I can tell the workflow to try again without being stressed? Or to carry on from where it left off?

Hi @goldstartefl,

It sounds like you’re experiencing some intermittent errors with your workflows. One possible solution is to use the $.flow.rerun function in your code to retry a specific step multiple times if it fails. This can be useful if you’re making API requests and want to handle errors like service outages or rate limits.

Here’s an example of how you can use $.flow.rerun to retry a failed API request:

import { axios } from "@pipedream/platform"

export default defineComponent({
  props: {
    // Your props here
  },
  async run({ steps, $ }) {
    try {
      // Make your API request here
      return await axios($, {
        // Your request config here
      })
    } catch (error) {
      const MAX_RETRIES = 3
      const DELAY = 1000 * 30

      // Retry the request every 30 seconds, for up to 3 times
      $.flow.rerun(DELAY, null, MAX_RETRIES)
    }
  },
})

You can adjust the MAX_RETRIES and DELAY variables to fit your needs. This way, if a request fails, the workflow will automatically retry it a few times before giving up.

I hope this helps! Let me know if you have any other questions.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.

So I am noob - treat me like one. Do I do input this code? Where? I am not a software devloper

Hi @goldstartefl,

Could you share the screenshot of your error? Which action that resulted in error? Is it Open AI, or Dropbox action?

Thanks again for replying! So a quick overview of the workflow is exactly how you showed me earlier-
Trigger: New page in Notion Database
Retrieve block
Chat Gpt Prompt
Append block: Write onto the page

Because of the amount I am writing - I have about 11 Chat GPT prompts and 6 append blocks in the one workflow.

So here are the error requests and where they tend to be:

Chat GPT Prompt: - so when I rerun this it works fine - any solutions to stop this happening? do the ‘flow rerun’ mentioned by the bot? Happened in multiple workflows.

Error - Request failed with status code 500

{“error”:{“message”:“The server had an error while processing your request. Sorry about that!”,“type”:“server_error”,“param”:null,“code”:null}}

    at null.createError (/pipedream/dist/code/fe13c30c87ab5880186b1834127d9f2bc78840ae70c6b7199e8430ea7e9f18e5/node_modules/.pnpm/axios@0.21.4/node_modules/axios/lib/core/createError.js:16:15)
    at null.settle (/pipedream/dist/code/fe13c30c87ab5880186b1834127d9f2bc78840ae70c6b7199e8430ea7e9f18e5/node_modules/.pnpm/axios@0.21.4/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/pipedream/dist/code/fe13c30c87ab5880186b1834127d9f2bc78840ae70c6b7199e8430ea7e9f18e5/node_modules/.pnpm/axios@0.21.4/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (events.js:412:35)
    at null.endReadableNT (internal/streams/readable.js:1333:12)
    at process.processTicksAndRejections (internal/process/task_queues.js:82:21)

Chat GPT - so when I rerun this it works fine - any solutions to stop this happening? do the ‘flow rerun’ mentioned by the bot? Happened in multiple workflows.

Error - Request failed with status code 503

{“error”:{“message”:“That model is currently overloaded with other requests. You can retry your request, or contact us through our help center at help.openai.com if the error persists. (Please include the request ID fcf35e6bcb6baad6444604df5b0b2924 in your message.)”,“type”:“server_error”,“param”:null,“code”:null}}

    at null.createError (/pipedream/dist/code/fe13c30c87ab5880186b1834127d9f2bc78840ae70c6b7199e8430ea7e9f18e5/node_modules/.pnpm/axios@0.21.4/node_modules/axios/lib/core/createError.js:16:15)
    at null.settle (/pipedream/dist/code/fe13c30c87ab5880186b1834127d9f2bc78840ae70c6b7199e8430ea7e9f18e5/node_modules/.pnpm/axios@0.21.4/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/pipedream/dist/code/fe13c30c87ab5880186b1834127d9f2bc78840ae70c6b7199e8430ea7e9f18e5/node_modules/.pnpm/axios@0.21.4/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (events.js:412:35)
    at null.endReadableNT (internal/streams/readable.js:1333:12)
    at process.processTicksAndRejections (internal/process/task_queues.js:82:21)

Append block - So in the append block I will have multiple ‘Mark Up’ from multiple chat gpt prompts. Basically I do not do an append block after every chat gpt prompt. So I resolved this by splitting the ‘Mark Up’ contents to another append block. I am cool with that. Unless you have a better solution? Happened in some workflows.

APIResponseError

body failed validation: body.children.length should be ≤ 100, instead was 149.

    at null.buildRequestError (/pipedream/dist/code/5f0ecdc3fb159213079a7c0d5875fdac0f9e6758ce148df24ee70679703980b4/node_modules/.pnpm/@notionhq+client@2.2.5/node_modules/@notionhq/client/build/src/errors.js:162:16)
    at Client.request (/pipedream/dist/code/5f0ecdc3fb159213079a7c0d5875fdac0f9e6758ce148df24ee70679703980b4/node_modules/.pnpm/@notionhq+client@2.2.5/node_modules/@notionhq/client/build/src/Client.js:347:54)
    at process.processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Object.run (file:///pipedream/dist/code/5f0ecdc3fb159213079a7c0d5875fdac0f9e6758ce148df24ee70679703980b4/code/actions/append-block/append-block.mjs:79:25)
    at global.executeComponent (/var/task/launch_worker.js:225:22)
    at MessagePort.messageHandler (/var/task/launch_worker.js:722:28)

Append Block - no idea. When I reran it it worked fine - happened only once.

FetchError

Invalid response body while trying to fetch https://api.notion.com/v1/blocks/09467364-9312-4ac3-8298-ccb12926602f/children: read ECONNRESET

    at Gunzip.null (/pipedream/dist/code/5f0ecdc3fb159213079a7c0d5875fdac0f9e6758ce148df24ee70679703980b4/node_modules/.pnpm/node-fetch@2.6.11/node_modules/node-fetch/lib/index.js:400:12)
    at Gunzip.emit (events.js:412:35)
    at null.emitErrorNT (internal/streams/destroy.js:106:8)
    at null.emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at process.processTicksAndRejections (internal/process/task_queues.js:82:21)

Append Block - this is sooooo annoying. My content requires a table with data generated by a chatgpt prompt. It works for 70-80% of the time. But every now and again - even though the chat gpt returns a table at my request, the Append block will not write it on the page. It will have the below error. And as far as I can see - it is only 2 or 3 columns wide and it worked in other workflows with no issues. Really annoying because I want the table. To resolve it I go back to the prompt and make sure it doesn’t give me the table, but just the data. Then I will go into the pages in notion and redo them as a table.

APIResponseError

Content creation Failed. Fix the following: Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table Number of cells in table row must match the table width of the parent table

    at null.buildRequestError (/pipedream/dist/code/5f0ecdc3fb159213079a7c0d5875fdac0f9e6758ce148df24ee70679703980b4/node_modules/.pnpm/@notionhq+client@2.2.5/node_modules/@notionhq/client/build/src/errors.js:162:16)
    at Client.request (/pipedream/dist/code/5f0ecdc3fb159213079a7c0d5875fdac0f9e6758ce148df24ee70679703980b4/node_modules/.pnpm/@notionhq+client@2.2.5/node_modules/@notionhq/client/build/src/Client.js:347:54)
    at process.processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Object.run (file:///pipedream/dist/code/5f0ecdc3fb159213079a7c0d5875fdac0f9e6758ce148df24ee70679703980b4/code/actions/append-block/append-block.mjs:79:25)
    at global.executeComponent (/var/task/launch_worker.js:225:22)
    at MessagePort.messageHandler (/var/task/launch_worker.js:722:28)

Hope this helps