Support Questions

Find answers, ask questions, and share your expertise

Issue with NiFi 2.0.0-M4: crypto.randomUUID is not a function Error

avatar
New Contributor

I recently downloaded the latest version of NiFi (nifi-2.0.0-M4) and installed it by placing the folder in /opt/nifi-2.0.0-M4. The only modifications I made were in the nifi-env.sh and nifi.properties files as follows:

nifi-env.sh

export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64

nifi.properties

# Site to Site properties
nifi.remote.input.host=10.37.10.199
nifi.remote.input.secure=false
nifi.remote.input.socket.port=10000
nifi.remote.input.http.enabled=true
nifi.remote.input.http.transaction.ttl=60 sec
nifi.remote.contents.cache.expiration=60 secs

# web properties #
#############################################

# For security, NiFi will present the UI on 127.0.0.1 and only be accessible through this loopback interface.
# Be aware that changing these properties may affect how your instance can be accessed without any restriction.
# We recommend configuring HTTPS instead. The administrators guide provides instructions on how to do this.

nifi.web.http.host= 0.0.0.0 # Here goes the IP of my virtual machine in Ubuntu
nifi.web.http.port=8443
nifi.web.http.network.interface.default=

#############################################

nifi.web.https.host=
nifi.web.https.port=

When I run ./nifi.sh start, the server starts correctly and there are no errors in the console. However, when I open the URL in the browser, the page remains blank and the following error appears in the browser console:

TypeError: crypto.randomUUID is not a function

Additional Information:

  • Operating System: Ubuntu
  • Java Version: OpenJDK 21
  • NiFi Version: 2.0.0-M4

Has anyone else encountered this issue or can provide guidance on how to resolve it? Any help would be greatly appreciated!

Screenshot 2024-07-12 161846.jpg

 

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Twelve @aLiang 

The crypto.randomUUID() issue when running NiFi over HTTP or on localhost has been resolved via https://issues.apache.org/jira/browse/NIFI-13680.

The fix will be part of next release after NiFi-2.0.0-M4.

Thanks,
Matt

View solution in original post

5 REPLIES 5

avatar
New Contributor

Hi,

I am also facing the same problem with no solution at the moment. Sharing some information which may shed some light as to why the issue is observed.

https://stackoverflow.com/questions/105034/how-do-i-create-a-guid-uuid/2117523#2117523

avatar
Community Manager

@SAMSAL @MattWho Hi! Do you have any insights here? Thanks!


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

avatar
New Contributor

Hello ,this TypeError: crypto.randomUUID is not a function occurs because the environment in which you are running your application does not support the crypto.randomUUID() function. It is a versioning problem, either you solve the Polyfill from the code, or you can add this extension:

erikaGutierrez_0-1726871502623.png


Once installed, create a new script and add this code.

(function() { 'use strict'; if (typeof crypto.randomUUID !== 'function') { crypto.randomUUID = function () { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); }; } })();

Or you can generate a static UUID from here:: https://www.uuidgenerator.net/version4

Enable developer mode in your browser, restart the extension, and then you will be able to see your started Nifi normally.

erikaGutierrez_1-1726871628295.png

erikaGutierrez_2-1726871965224.pngerikaGutierrez_3-1726871979493.png

Use this for test scenarios.

 

 

avatar
New Contributor

crypto.randomUUID is only allowed to run on HTTPS, and localhost should also be able to run on it. 
Crypto.randomUUID() - Web API | MDN (mozilla.org)

avatar
Master Mentor

@Twelve @aLiang 

The crypto.randomUUID() issue when running NiFi over HTTP or on localhost has been resolved via https://issues.apache.org/jira/browse/NIFI-13680.

The fix will be part of next release after NiFi-2.0.0-M4.

Thanks,
Matt