Trying to require multiple modules (Access denied to require)

Hello,

I’m trying to require a mudule in a Function node using JS.
At first I received the error “Access denied to require aws-sdk” until I solved it by setting the environment variable “NODE_FUNCTION_ALLOW_EXTERNAL” with the value “aws-sdk”.

Everything worked fine until I needed to require a different module in a different node.
I tried to set multiple values to the variable by changing the value to “aws-sdk;fs;” but this didn’t do the trick. Seems like it doesn’t accept multiple values.

I want to be able to require modules in function nodes. What’s the correct way to do that and pass the “Access denied to require” error?

Thanks

Welcome to the community @Itay!

It is possible but the module names have to be comma-separated as mentioned in the documentation here.

2 Likes

Thank you!

I actually guess comma and it passed the aws-sdk but failed the fs.
After checking the link you referenced I understood it was because the fs module should have been under the parameter “NODE_FUNCTION_ALLOW_BUILTIN” which is a different one.

Thanks again.

2 Likes

Ah, yes. Very good catch, totally overlooked that the second module is “fs” (a Node.js built-in module) which should so go under “NODE_FUNCTION_ALLOW_BUILTIN” instead anyway as you pointed out.