39
Views
4
Comments
RunTime Error: Module name "crypto" has not been loaded yet for context:
Application Type
Mobile, Reactive

I am trying to load the external Js file (face-api.js) as a required script of page and getting the below error:

[ErrorScreen] Module name "crypto" has not been loaded yet for context: _. Use require([])
https://requirejs.org/docs/errors.html#notloaded 

although the same code is working with Plain HTML and Javascript project.

already gone through these links (link1 , link2) to load the js file as well and tried provided solutions but nothing helps. 


2019-01-07 16-04-16
Siya
 
MVP

Could you please share the  HTML and JavaScript code, or provide a link to download it? This will allow someone to try it in their environment and offer support.

2021-08-04 12-19-54
Mayank Dharmpurikar

you can download the HTML JS code from here and OML file here.

Note - To run the HTML/JS code I used the visual studio code and run from the link server.

2019-01-07 16-04-16
Siya
 
MVP

Thank you for sharing the files. I spent some time making it work and noticed that including `face-api.min.js` in Screens causes conflicts and results in the same errors you reported.

Could you please clarify your use case? Do you want to show the video with detection information, or are you expecting to return something to OutSystem actions?

I managed to make it work by uploading all the files to the resources folder. I made a couple of changes:

  1. Modified `script.js` to include the application name in the path.
  2. Renamed some files in the model folder that didn't have extensions to `.txt` so Platform Server can serve them correctly. Respective references were updated in the JSON files.
  3. Renamed `index.html` to `index1.html`. You can run it by accessing `http://yourenvironment/FaceDetection/index1.html`. It can then be rendered inside a screen using an iframe.

Please note that this works in Chrome but not in Safari. I will not call this is a solution but a work around.

I have attached the OML file (here) . Feel free to make any changes.

2025-06-07 16-46-54
Victor Abreu

Hi Mayank, I had the same error as you.

To fix it, you need to remove the reference of 'crypto' on the face api min script. After this, you need to import the resources to your application, change the archives without extension to '.bin' and reffer this on the respective 'manifest.json' and then you may use the api. I created one component that do this. you can check on forge:

https://www.outsystems.com/forge/component-overview/20323/facial-recognition-o11

Note: to use on web applications, ou need to activate the 'graphics accelaration' on the web navigator

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.