What Could be Causing an Error in My Nodejs Script?

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

Getting this error when I’m trying to get my Nodejs script to run through. Any ideas?

Also getting this in scheduled runs - the code is exactly the same that works when run manually.

Hi , if it is possible could you share your node.js code here?

Yes please! Or if you prefer you can share your workflow or project with support!

Maybe there’s something wrong with the Project / Workflow, because giving Pipedream Support Access fails? I pressed Update Project

Can you copy and paste here the workflow URL?

Thanks, I’ll look into it!

Maybe there’s also problem with the GitHub sync - it doesn’t seem to synchronize all the changes to GitHub.

There are two flows with the same content:
The latter one is just a copy, which I set up to check out that if the first one is somehow corrupted.

In Pipedream, we have a custom structure called components:

export default defineComponent({
  async run({ steps, $ }) {
    console.log("This is Node.js code");
    $.export("test", "Some test data");
    return "Test data";

See our docs here for Node.js code steps

You can define functions outside the default export, but the async run() function is the one that will be invoked

Feel free to ask any questions you have on our guide at:

Re: git sync, something looks funky with the auth connection. Is it connected via OAuth or Deploy Keys?

OAuth I guess

Should I somehow reauthorize the GitHub connection?

For sure

Let me know if that works or not

Reconnecting doesn’t work . The Connected Accounts > GitHub doesn’t show any Connected Workflows.

I’m trying next deleting all and recreating the link to GitHub.

Well, the GitHub connection seems to be working now, I deleted the Connected Account, also the GitHub repository and recreated it + one development branch. The original problem probably was that the wizard that creates the Connected Accounts accidentally created two GitHub connections and I deleted the wrong one (connected to the project & workflow). Now it seems to work.

Next I’m trying to refactor the Node.js based on the guide.

I refactored the Nodejs script based on the guide, and it again completes correctly in the Edit mode. However, when I have set a trigger and try Run now in production nothing happens. (Last time this generated a row in Waiting for events box and started running, but now the button just dims for a few seconds and reverts back.)

No error, no change in UI, no error messages in javascript console :thinking_face:

Also tried logging out and logging in, changing a browser, but still nothing happens.