workflowContext.currentRun.error.message always null

I'm trying to setup an error handling to post to slack on error. For some reason, the workflowContext.currentRun.error.message.ToString() is always showing as null. If I don't use .ToString(), then the Slack message errors with invalid_blocks_format.

Hi @jonnilundy, welcome to the forum! :wave:

Could we try adding a JS block as the error handler that returns workflowContext.currentRun.error.message to make sure the message is what we're expecting? Then, have the Slack block reference whats returned by the JS block instead.

Only getting a null response

Let's try with a JS block:
Screenshot 2024-05-07 at 5.34.38 PM

Works in a JS block.

This is what I meant:

Note: My Slack integration has different parameters, use yours.


When we run the workflow and there is an error, we should be able to see the value of code1.data in the logs.
ā€‹

1 Like

Interesting. Is the desired flow? Seems a bit strange to add a block just to return a variable that already exists.

Thanks for the workaround!

Tried this in production but its not working.

This is definitely not the desired flow, it was mostly to confirm the output of workflowContext.currentRun.error.message before we send it to the Slack query, but I'm glad we got it to work in the editor so far. Could you confirm the edits we made were deployed before testing in production?

Just confirmed that it is indeed deployed.

Could you share the logs from the workflow?

Mo 05/20/2024 11:31:25	Starting run for workflow: 92154227-900e-4f25-b1f9-40685227e995 in environment production
Mo 05/20/2024 11:31:25	Workflow Run Id: 374129c9-18cb-4bff-b203-1f6dbe9250a3
Mo 05/20/2024 11:31:25	Workflow Trigger Id: 803df13c-c54b-4308-8021-36174f25d5ee
Mo 05/20/2024 11:31:25	--- Running query: startTrigger ---
Mo 05/20/2024 11:31:25	--- Successfully finished running query: startTrigger ---
Mo 05/20/2024 11:31:25	--- Running query: tld ---
Mo 05/20/2024 11:31:25	--- Successfully finished running query: tld ---
Mo 05/20/2024 11:31:25	--- Running query: dnsData ---
Mo 05/20/2024 11:31:26	--- Successfully finished running query: dnsData ---
Mo 05/20/2024 11:31:26	--- Running query: prettyNameserver ---
Mo 05/20/2024 11:31:26	--- Successfully finished running query: prettyNameserver ---
Mo 05/20/2024 11:31:26	--- Running query: isServerReachable ---
Mo 05/20/2024 11:31:27	--- Successfully finished running query: isServerReachable ---
Mo 05/20/2024 11:31:27	--- Running query: mxLookup ---
Mo 05/20/2024 11:31:27	--- Successfully finished running query: mxLookup ---
Mo 05/20/2024 11:31:27	--- Running query: getTeam ---
Mo 05/20/2024 11:31:27	--- Successfully finished running query: getTeam ---
Mo 05/20/2024 11:31:27	--- Running query: saveDomainToDB ---
Mo 05/20/2024 11:31:28	--- Successfully finished running query: saveDomainToDB ---
Mo 05/20/2024 11:31:28	--- Running query: triggerSperta ---
Mo 05/20/2024 11:31:28	Error evaluating triggerSperta: {"code":3,"message":"Invalid input to Timestamp feature `dns_registrar_expiring_at`: `map[]`.","details":[]}
Mo 05/20/2024 11:31:28	--- Failed running query: triggerSperta ---
Mo 05/20/2024 11:31:28	--- Hit failure, skipping queries: createCase, selectRuleOutputs, createCaseDecisions, actionBranch, blockHard, blockSoft, review, successResponse ---
Mo 05/20/2024 11:31:29	--- Running query: error ---
Mo 05/20/2024 11:31:29	--- Successfully finished running query: error ---
Mo 05/20/2024 11:31:29	--- Running query: errorNotification ---
Mo 05/20/2024 11:31:29	--- Successfully finished running query: errorNotification ---
Mo 05/20/2024 11:31:31	--- Successfully finished running the workflow ---

This run sent this message to slack: