Skip to content

Function node did not timeout under certain situation #402

@justin0108

Description

@justin0108

Hi,

The function node is suppose to timeout and throw interrupted after 5 seconds. However this does not always happen. I have created 2 examples to illustrate it. I purposely use "while (true)" just to simulate that it has a bunch of unoptimised code.

This will throw Error: interrupted

export const handler = async (input) => {
  let i = 0;
  while (true) {
    ++i;
  }
  return input;
};

This does not seem to throw any error after a long time ( > 5 seconds )

export const handler = async (input) => {
  while (true) {
    console.log("hello")
  }
  return input;
};

We have another situation where it is not "while (true)" but its a bunch of heavy looping codes. It is not optimised. We are expecting the function to throw interuppted but it didnt which causes the whole flow to "hang" indefinitely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions