Why is the $end() Function Not Working Despite Following the Pipedream Documentation?

This topic was automatically generated from Slack. You can find the original thread here.

Is anyone aware of a bug preventing the $end(); function from working?

I’ve based my end function on the documentation here but it does not work: Code

Example code:
export default {
name: “Check status and possibly end workflow”,
async run({ steps, $ }) {
const status = steps.trigger.event.body.status;
if (conversation_status === “abandoned”) {
$end(“Ending workflow.”);
}
return steps.trigger.event;
},
}

Gives the error:
ReferenceError
$end is not defined

DETAILS
at Object.run (file:///tmp/pdg/dist/code/b6aa7dbaba653828424a39732a2edd3f1603362e0e796905c92c00297cb73435/component.mjs:6:7)
at null.executeComponent (/var/task/launch_worker.js:242:53)
at MessagePort.messageHandler (/var/task/launch_worker.js:748:28)

Ah the documentation appears to be out of date:

That’s right, sorry about that! How’d you make your way to that page in the docs by the way?

just to confirm, is this for a v2 workflow? We still keep the v1 docs around (notice /v1 in the path) since many users still run v1 workflows. If you visit Introduction to Pipedream, only v2 results should appear.

:student: Should have checked. I’ve got a habit of assuming documentartion is always up to date. It was for a v2 work flow.

How did you find that link?

Google I think.

I see, yeah we do still index the content but once we support a v1 to v2 migration we’ll likely sunset all of that