Nodejs packages in automation

Hello,

I wanted to test some things with server-side actions and automations, but there are some issues with Node.js core packages.

Some weeks ago, I posted some server-side code using the bcrypt library in this post, which still works fine if copied 1:1. The code imports the packages directly like:

import bcrypt from 'https://cdn.jsdelivr.net/npm/bcryptjs@3.0.2/+esm';
import isaac from 'https://cdn.jsdelivr.net/npm/isaac@0.0.5/+esm';
...

I then wanted to check out if it would still work the same using the new Packages tab:
image
So I added both packages there like this:

{
  "dependencies": {
    ...
    "bcrypt": "^3.0.2",
    "isaac": "^0.0.5"
  }
}

and used the imports like you would normally in a Node.js environment and as described in the docs:

import bcrypt from 'bcrypt';
import isaac from 'isaac';

but this throws an error:

I tried several things to manually import the path module, but nothing worked, so I assume this is either a deliberate decision by UI-Bakery or something not configured correct?
The docs state that

Libraries dependent on the fs and child_process modules are currently not supported.

So I thought the path module should have no issue. It’s also interesting to see that it works with the links of the libraries, but not the packages.

Hi @Max

I will check with the dev team on this.
Cheers

1 Like

Hi @Max

We will add the path module. I’ll let you know once it’s available

1 Like

@Max we’ve added the requested module; however, it looks like it’s still not working properly, as now it’s throwing errors:

Looks like it’s quite a complicated case, so the dev team was asking if you can use bcryptj instead. If not, we’ll try to investigate further, but there’s a very small chance this module can be added (but we’ll try our best :grinning_face:)

1 Like

I see how it is. Well, I mainly wanted to test things for other people asking stuff here, so bcryptj should do fine :slight_smile:.

Thank you Kate!

1 Like