External or Internal hook for Execution Started

Hey, Hope you’re doing fine.

I’m wondering if there is any external or internal hook for “after an execution just started”. There is workflow.preExecute hook which is being called without execution id obviously. But I need the execution id.

Thanks

Hi @jellybean, I think there’s only a frontend hook workflowRun.runWorkflow which is probably not what you have in mind.

So, for the time being I’ll convert this into a feature request for you and other users to vote on.

Hi @MutedJam,

Is there any update about this case? I’m also looking for accessing the execution id. I tried a custom webhook trigger node, but I didn’t find a related context API or state to access the execution id in the webhook function.

Thanks

I also tried to add executionId to response headers on webhook node as below. But I’ve got an error like below.

/Users/.../.nvm/versions/node/v19.1.0/lib/node_modules/n8n/dist/ErrorReporting.js:59
            throw error;
            ^

InternalServerError [ResponseError]: Invalid value "undefined" for header "executionId"
    at Object.executeWebhook (/Users/.../.nvm/versions/node/v19.1.0/lib/node_modules/n8n/src/WebhookHelpers.ts:679:9)
Emitted 'error' event on Domain instance at:
    at emit (node:internal/process/promises:138:33)
    at processPromiseRejections (node:internal/process/promises:274:27)
    at processTicksAndRejections (node:internal/process/task_queues:97:32) {
  httpStatusCode: 500,
  errorCode: 500,
  hint: undefined

Hey @Yalcin_Ari,

Doing it like this appears to work, I suspect the execution ID doesn’t exist until the workflow actually runs but because the node is replying back instantly it has not had a chance to generate one.

Trigger nodes run outside of executions (or more before them).

The reason is that they actually have to emit the event which starts the actual execution. Meaning there is not execution yet at that time for that reason also no ID.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.