title: How to generate a UUID in NextJs?
body: <p>I'm trying this</p>
  <pre class="lang-js prettyprint-override"><code>import { randomUUID } from 'crypto'
  var id = randomUUID()
  </code></pre>
  <p>in my NextJs app but I'm getting this error:</p>
  <blockquote>
  <p>index.js?46cb:369 Uncaught TypeError: (0 ,
  crypto__WEBPACK_IMPORTED_MODULE_5__.randomUUID) is not a function
  at eval (index.js?bee7:8:20)
  at Module../pages/index.js (index.js?ts=1649816623582:5680:1)
  at Module.options.factory (webpack.js?ts=1649816623582:618:31)
  at <strong>webpack_require</strong> (webpack.js?ts=1649816623582:37:33)
  at fn (webpack.js?ts=1649816623582:287:21)
  at eval (?595a:5:16)
  at eval (route-loader.js?ea34:235:51)</p>
  </blockquote>
  <p>it seems like the crypto library is available to middleware in NextJs (though it should be available at the browser) but that seems complicated to implement.  can anyone suggest how to generate a UUID in NextJs?</p>