Hi!
I’m trying to use the [bir1](https://www.npmjs.com/package/bir1/v/4.1.0)
library in my custom code step in Activepieces, but I keep getting the following error:
Error [ERR_REQUIRE_ESM]: require() of ES Module bir1 from index.js not supported.
Instead change the require to a dynamic import() which is available in all CommonJS modules.
Here is my code:
export const code = async (inputs) => {
const { apiKey, nip } = inputs;
const { default: Bir } = await import('bir1');
const birClient = new Bir(apiKey);
await birClient.login();
const result = await birClient.search({ nip });
return result;
};
As you can see, I’m already using import()
dynamically, but Activepieces still throws an error as if it’s trying to require()
the ESM module internally. I believe this may be because Activepieces runs the code in a CommonJS environment.
Any help would be much appreciated — thank you!