Create uuid in realm mongodb functions

hi,

I installed the npm package uuid. Now I like to generate a new id like:

const { v4: uuidv4 } = require('uuid');
console.log(uuidv4());

but this produce following error:

TypeError: 'slice' is not a function
    at rng (node_modules/uuid/dist/rng.js:29:10)
    at exports (function.js:12:15)
    at apply (<native code>)
    at function_wrapper.js:5:9
    at <anonymous>:11:1
  1. Is it not possible to use this package?
  2. if not, how can I generate a new uuid string?

thx

Hi Rouuuge - thanks for posting.

To help us see more details of where the issues lies - would you have a repo to share?

hi,

Currently not possible to share it but here a small snipped how to repoduce my realm-function:

exports = async function() {
  const { v4: uuidv4 } = require('uuid');
  console.log(uuidv4());
}

and following node-modules that I imported:

{
  "dependencies": {
    "dayjs": "^1.9.3",
    "uuid": "^8.3.2"
  }
}

thx for help!