Thanks @danny, I was trying with static imports instead of dynamic ones. Just in case someone else encounters this issue, it worked with the following dynamic imports:
@germanescobar workflows run as AWS Lambda scripts behind the scenes: we run a custom execution environment within the Lambda environment, and rely on the AWS Node 14 runtime to execute your code.
We’re planning to address this in better ways in the future (e.g. by letting you pin package versions), and we plan to allow static ESM imports when the AWS runtime supports it.
For me, it looks like an npm package is causing the error message. I replaced the ‘require’ code in the workflow, but still get “Must use import …” for fetch.
Thanks so much, I’ve shared it with you. I feel like all is well in the workflow and your documentation is invaluable.
I believe it’s the way the ‘fm-data-api-client’ npm package is trying to load fetch itself. I forked their project, but looks like creating a valid npm package is above what I can do right now. I have an editable one at ‘Lab548/fm-data-api-client’ but not shared with npm.
This is a new workflow, but I have 5-6 others across two accounts that are live and use the same code, so trying to get ahead of them failing.
I did look at what’s going on in the ‘node-fetch’ GitHub page, so totally get this is coming from elsewhere and there’s apparently a good deal of controversy.
@pegasuslegal in this case, I would recommend trying to publish an npm package from your fork. I actually just did the same thing and got it working, so I’ll walk you through what I did.
Edit the name of the package.json to @<your npm username>/fm-data-api-client. For example, my npm username is @dylburger, so I’ve changed it to @dylburger/fm-data-api-client.
I’m green on npm sharing, so wasn’t sure on the extent of package.json editing needed and this is awesome. I’ll use yours as a one example and get one published.
Really appreciate it!
I’ve been meaning to get back to you and Tod on what I’ve been using Pipedream for and will be sure to do that this week.