diff --git a/utils/GunSmith/GunSmith.js b/utils/GunSmith/GunSmith.js
index 087c032e..1cd45ac8 100644
--- a/utils/GunSmith/GunSmith.js
+++ b/utils/GunSmith/GunSmith.js
@@ -6,11 +6,21 @@
// @ts-check
///
///
+const RealGun = require('gun')
const uuid = require('uuid/v1')
const { fork } = require('child_process')
const logger = require('../../config/log')
+const gunUUID = () => {
+ const RG = /** @type {any} */ (RealGun)
+ if (typeof RG.text === 'object' && typeof RG.text.random === 'function') {
+ return RG.text.random()
+ }
+ // This probably won't happen
+ throw new ReferenceError()
+}
+
/**
* Maps a path to `on()` listeners
* @type {Record|undefined>}
@@ -349,8 +359,8 @@ function createReplica(path, afterMap = false) {
if (afterMap) {
throw new Error('Cannot call set() after map() on a GunSmith node')
}
- // @ts-expect-error
- const id = Gun.text.random()
+
+ const id = gunUUID()
this.put(
{
[id]: data