FlowFuse / FlowFuse/flowfuse

Replace uuid library with native crypto.randomUUID()

Open
#7,193 3 comments 0 reactions 0 assignees View on GitHub
task
Dominant language
JavaScript
Stars
400
Forks
89
Avg merge
1d 20h
Merged PRs (30d)
149

Description

### Description

We should drop the uuid dependency in favor of the built-in crypto.randomUUID() in preparation for support for NR5.

Node-RED 5 introduces a hard dependency on Node.js ≥ v22.9. When FlowFuse is run on that Node version, it crashes on startup with an ERR_REQUIRE_ESM error from the uuid package. The fix is to drop the uuid dependency and use the built-in crypto.randomUUID() instead.

```bash
Error [ERR_REQUIRE_ESM]: require() of ES Module
.../node_modules/uuid/dist-node/index.js
from .../forge/comms/commsClient.js not supported.
Instead change the require of index.js in
.../forge/comms/commsClient.js to a dynamic import()
which is available in all CommonJS modules.
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at Object. (.../forge/comms/commsClient.js:5:24) {
code: 'ERR_REQUIRE_ESM'
}
```
This approach was already taken in NR5 https://github.com/node-red/node-red/pull/5660

### Epic/Story

_No response_

### Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.