Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dialogflow ES: Training phrase Error: rangy is not define

Hi,

While I am selecting the part of the training phrase to annotate with the console, it is showing 'ReferenceError: rangy is not define'

vengal_0-1701506040297.png

Regards
vengal

3 8 723
8 REPLIES 8

I have the same. I cannot annotate sentences anymore. Any solution yet?

Hi, I cannot annotate sentences too

I also cannot annotate and this is driving me crazy

The error message "rangy is not defined" in Dialogflow ES typically occurs when there's a JavaScript issue with the rangy library, which might be used in your custom code or within the fulfillment for handling training phrases or other functionalities.

Here are some steps to troubleshoot this:

  1. Library Reference: Ensure that you have properly referenced the rangy library in your code if you're using it directly. Check if you've included the necessary <script> tag to import it into your web page or fulfillment code.

  2. Library Integration: If you're using rangy in your fulfillment code (such as in webhook or inline editor), confirm that you've properly imported and initialized it before using any of its functions.

  3. Library Version: Check if you're using the correct version of the rangy library. Sometimes, specific versions might introduce breaking changes or require different methods of integration.

  4. Namespace Conflict: There might be a conflict with the namespace if other libraries are using a similarly named object. You can try renaming or aliasing rangy to avoid conflicts.

  5. Library Loading: Ensure that the rangy library is properly loaded and available before your code tries to access it. Sometimes, delays in loading scripts can cause such errors.

Without seeing the specific code causing the error, it's a bit challenging to pinpoint the exact issue. If you can provide more details or code snippets related to how you're using rangy in Dialogflow, I might be able to offer more precise help.

Hi Poala_Tenorio,

I am not using any custom code, i am using only dialog flow's console screen for training purpose,  when I am trying to select the part of the training phrase to annotate, it is not selecting and showing 'ReferenceError: rangy is not define' in the chrome dev tools.

Regards

Vengal

Uncaught ReferenceError: rangy is not defined
    at HU.default.onSelect (m=dialogflow_core:5720:22)
    at HU.default.mouseUpSelection (m=dialogflow_core:5718:193)
    at HTMLDivElement.dispatch (m=dialogflow_core:710:509)
    at Ab.handle (m=dialogflow_core:706:406)

We are not using any custom code

That's just console output when we highlight a part of the sentence in the Intent's Training Phrases, in the Dialogflow ES console at https://dialogflow.cloud.google.com/

This thing has been going on for more than a week

You can try the following workaround.

Go to your browser's developer console and load the library rangy

 

// Rangy Core
var scriptCore = document.createElement('script');
scriptCore.src='https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.1/rangy-core.min.js';
document.head.appendChild(scriptCore);

// Rangy ClassApplier
var scriptClassApplier = document.createElement('script');
scriptClassApplier.src='https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.1/rangy-classapplier.min.js';
document.head.appendChild(scriptClassApplier);

// Rangy TextRange
var scriptTextRange = document.createElement('script');
scriptTextRange.src='https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.1/rangy-textrange.min.js';
document.head.appendChild(scriptTextRange);

// check load
scriptTextRange.onload = function() {
console.log('Rangy library loaded successfully.');
};

 

Can confirm that this workaround works! Although a more permanent solution should be implemented, This seems to affect everyone regardless of browser and system

Screenshot 2023-12-17 at 2.52.39 PM.png

pic of my console in the dialogflow console page, first error seems to be my adblock (tried turning it off but seems unrelated to the rangy problem), the 2nd uncaught error appears only after I highlight the phrase to annotate it 

I've tried using safari, edge, logged in the console using a windows labtop, but based on the results and the console log, seems to be a problem on the dialogflow part