Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Go to siteDevelop, run and deploy your Node.js code in Pipedream workflows, using it between no-code steps, with connected accounts, or integrate Data Stores and File Stores.
This includes installing NPM packages, within your code without having to manage a package.json
file or running npm install
.
Below is an example of installing the axios
package in a Pipedream Node.js code step. Pipedream imports the axios
package, performs the API request, and shares the response with subsequent workflow steps:
// To use previous step data, pass the `steps` object to the run() function
export default defineComponent({
async run({ steps, $ }) {
// Return data to use it in future steps
return steps.trigger.event
},
})
To add a Node.js code step, open a new workflow and include a step.
Now you’re ready to write some code!
On the right, you'll see the default code provided by Pipedream:
// To use any npm package, just import it
// import axios from "axios"
export default defineComponent({
async run({ steps, $ }) {
// Reference previous step data using the steps object and return data to use it in future steps
return steps.trigger.event
},
})
You can write your custom code within the run
function. run
is called when this step executes in your workflow.
When you click Test on the Node.js code step, it will display the event data from your trigger step. For instance, if your trigger is an HTTP request, then the HTTP request data will be returned.
This step can execute any Node.js code. However, the run
function, a special Pipedream callback, must be set up correctly to return data. Otherwise, you can run arbitrary code that:
Pipedream’s pre-built actions and triggers (a.k.a. Sources) are built using Node.js. These components allow you to quickly build workflows by reusing logic with different inputs (also known as props).
These components are open source. You can fork the Pipedream repository and modify these components to your needs. You can even publish private actions and sources to your workspace for you and your team’s own use.
You can also contribute actions and triggers to Pipedream’s Registry which are published on Pipedream’s App Marketplace. Publishing your app on Pipedream integrates it for use with code steps as well as streamlined integrations with your own pre-built actions and triggers.
Components can be deployed to your workspace by using the Pipedream CLI, or within your workflows Node.js code steps directly.
To get started:
Generate Pipedream compatible Node.js code within your workflow with human language.
To get started, open a Node.js step and select the Edit with AI button.
Then, enter your prompt to generate code. Selecting a specific app generates the necessary integration code for API requests.
For example, select the Slack app and use the prompt:
Send a message to a public channel
This prompt will generate the corresponding code to send an API request to Slack and perform the action using your connected Pipedream account.
Write custom Node.js code and use any of the 400k+ npm packages available. Refer to the Pipedream Node docs to learn more.
Pipedream will show your error traces within your individual steps, under the Logs section.
Traces across all of your workflows are also available within the Event History in your Pipedream workspace. This gives a global view of all failed executions, and gives you the tools to filter by workflow, time occurred and more.
If there’s an issue with a specific Pipedream level construct, you’ll see specific error messages within the step itself.
A ConfigurationError
can occur if the props for the code step are invalid. For example, if you’re attempting to update a Google Calendar event, but the end_date
is before the start_date
, then the action may throw a specific ConfigurationError
to signal this action isn’t possible.
As a Pipedream action or source developer, you can also leverage ConfigurationErrors
to guide users of your action or source to pass appropriate data to props in order for the component to function properly.
For more details, visit the Configuration Error documentation.
If your code is performing an asynchronous action that is not properly awaited, you may see an error.
This error means that control has moved onto the next step, but there were unresolved promises within your Node.js code.
To keep Pipedream from moving onto the next step, use await
on your promises to hold execution until the promise finishes.
Read our docs on implementing asynchronous code in Node.js code steps.