# Enable require() in Node.js Functions on FlowFuse Instance(s)

**URL:** <https://discourse.nodered.org/t/enable-require-in-node-js-functions-on-flowfuse-instance-s/99301>\
**Category:** FlowFuse\
**Tags:** function-node\
**Created:** [7 October 2025 14:19 UTC](https://discourse.nodered.org/t/enable-require-in-node-js-functions-on-flowfuse-instance-s/99301 "2025-10-07T14:19:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeremyCee](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jeremycee/32/103727_2.png) [@JeremyCee](https://discourse.nodered.org/u/JeremyCee)\
**Post date:** [7 October 2025 14:19 UTC](https://discourse.nodered.org/t/enable-require-in-node-js-functions-on-flowfuse-instance-s/99301/1 "2025-10-07T14:19:53Z")

</div>

We're attempting to build a workflow where we need to validate the incoming webhook POST with a hashed value that's calculated from a shared key.

We're currently leveraging the `node-red-contrib-crypto-js` module but it requires the Shared Key/Secret Key field to be static/set in the ui field.

This is a multi-tenant workflow we need.

Is it possible to enable the ability to leverage `require()` in Function modules?

My engineer has asked so that we can attempt a solution "using `crypto/crypto-js` directly in a Function".

If this is not the best solution/not possible, we'd appreciate any other guidance. Would it be to just use multiple `node-red-contrib-crypto-js` modules on our workflow canvas and route to each one based on the tenant each event is assigned to for HMAC verification, then route back into our unified workflow?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 October 2025 14:35 UTC](https://discourse.nodered.org/t/enable-require-in-node-js-functions-on-flowfuse-instance-s/99301/2 "2025-10-07T14:35:39Z")

</div>

Hi @JeremyCee welcome to the forum.

> [@JeremyCee](#):
>
> Is it possible to enable the ability to leverage `require()` in Function modules?

No, but you don't _realy_ need to

> [@JeremyCee](#):
>
> My engineer has asked so that we can attempt a solution "using `crypto/crypto-js` directly in a Function".

You can simply add crypto-js to the setup tab.

> **[Use any npm module in Node-RED • FlowFuse](https://flowfuse.com/blog/2023/06/import-modules/)**
>
> Node-RED has an incredibly rich resource of integrations available, but sometimes you need that little extra. This shows you how.

### Setup

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/8/4831e066eb44398249cef2915b80f0c1c38dd81a.png)

### Demo

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/f/bf77b948a9a8629e11b4d7dfb2cfcd659c543c36.png)

### Function code

```js
const secretKey = 'mySecretKey'
msg.payload = CryptoJS.AES.encrypt(msg.payload, secretKey).toString()
return msg

```

---

<div class="post-metadata">

**Author:** ![JeremyCee](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jeremycee/32/103727_2.png) [@JeremyCee](https://discourse.nodered.org/u/JeremyCee)\
**Post date:** [7 October 2025 14:59 UTC](https://discourse.nodered.org/t/enable-require-in-node-js-functions-on-flowfuse-instance-s/99301/3 "2025-10-07T14:59:48Z")

</div>

Ahhh, _that's_ the button we needed! Showing our newness to the community in more ways than one. Thank you for the clear steps/visuals.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 October 2025 15:00 UTC](https://discourse.nodered.org/t/enable-require-in-node-js-functions-on-flowfuse-instance-s/99301/4 "2025-10-11T15:00:26Z")

</div>

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.
