PipedreamHQ / pipedream

Connect APIs, remarkably fast. Free for developers.
https://pipedream.com
Other
8.74k stars 5.26k forks source link

[BUG] importing Nhost Javascript Client breaks Node.js code steps #4321

Open ctrlaltdylan opened 1 year ago

ctrlaltdylan commented 1 year ago

Describe the bug When attempting to import the NhostClient from NPM, the Pipedream code step breaks with a message:

Code Error could not compute configurable props

To Reproduce Steps to reproduce the behavior:

  1. Create a new Node.js code step
  2. Attempt to import an version of the NHostClient
  3. Test and observe error
import { NhostClient } from '@nhost/nhost-js'

// 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
  },
})

Expected behavior I expect to be able to import the Nhost Client.

Screenshots

CleanShot 2022-09-23 at 09 56 14@2x

Additional context Reported from community here:

https://pipedream.com/community/t/error-code-error-could-not-compute-configurable-props/3299

vunguyenhung commented 1 year ago

I can also reproduce this on my side image

elitan commented 1 year ago

Nhost CEO here.

Is there anything we can do from our side to support resolving this issue?

ctrlaltdylan commented 1 year ago

Hi @elitan thanks for reaching out.

Does the NHost JS client make any changes to globals when it's imported?

I'm wondering if there's some kind of collision during the lifecycle of a Pipedream component.

DiesIrae commented 1 year ago

Importing the graphql-request library throws the same error for me.

AndrewSB commented 1 year ago

Importing "myq-api" does the same thing

mikeburgh commented 1 year ago

Importing 'pdf-parse' does the same thing as well, see: https://pipedream.com/community/t/node-code-error-in-ui-but-unable-to-see-the-error/3809/6

elitan commented 1 year ago

Does the NHost JS client make any changes to globals when it's imported?

Not that I know of.

renattomachado commented 1 year ago

@dylburger @ctrlaltdylan Any predictions to fix this? We are considering abandoning Pipedream because of this issue that has been preventing us from evolving.

dylburger commented 1 year ago

@renattomachado I looked into this more. Currently the original code:

import { NhostClient } from '@nhost/nhost-js'

// 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
  },
})

returns this error trying to install packages:

Error: Cannot find module 'graphql'

@elitan Is there a reason the @nhost/nhost-js package specifies graphql as a dev dep and not a production dep? Looks like @nhost/graphql-js also specifies the same (dev and peer dep). We install packages with pnpm -P, so would only install dependencies.

elitan commented 1 year ago

Pinging in @nunopato ☝️

dylburger commented 1 year ago

@nunopato I just wanted to check in to see if you had a moment to look into this.

@renattomachado FYI