Create an incident in a nodejs external task

Hi, How can i create an incident using the nodejs external task client? Thank you

You can do this using the Handel Failure method.

// Susbscribe to the topic: 'topicName'
client.subscribe("topicName", async function({ task, taskService }) {
  // Put your business logic
  // Handle a Failure
  await taskService.handleFailure(task, {
    errorMessage: "some failure message",
    errorDetails: "some details",
    retries: 1,
    retryTimeout: 1000
  });

});

No incident appearst in cockpit the token just hangs.

Did you set retries to 0?

No, you posted:

retries: 1

The code snippet I posted is the example from the docs and certainly needs some small tweaks to do what you would it to do.
For example you probably need to change the topicName but you should also set the retries to 0 to ensure it creates an incident.

I know it is the example from the docs, i tried it and no error occured that was the reason i asked this question, you know?

Super! I’m happy to help :slight_smile: