ECMAScript 6 features unavailable - Custom input activity

Hi, guys.

Currently when executing the HTML file through custom input activity (CIU), I’m getting messages that indicate that some features from JS may not be available .
For example:
imagen

“Error: ‘Fetch’ is not defined.”

Now, if the problem arises from support issues (because IE11 doesn’t support FETCH), how should I approach this efficiently? Perhaps through Polyfill. I’m not sure.

This is the JS code:

function LeerDatos() {
  
fetch('Database/LineaYClases.xlsx')
.then(function(res){
    // Qué hacer en caso de error
    if (!res.ok) throw new Error("No se pudo leer la base de datos.");
    return res.arrayBuffer();
})
.then(function(data){
    // Leemos los datos
    const rawData = new Uint8Array(data);
    const workbook = XLSX.read(rawData,{type: "array"})
     // Convertimos de Excel a JSON

    // Obtenemos el nombre la primera hoja del libro 
    const firstSheetName = workbook.SheetNames[0];
    // Leemos la primera hoja
    const worksheet = workbook.Sheets[firstSheetName];
    // Conversión
    const jsonData = XLSX.utils.sheet_to_json(worksheet, {raw: true});

    imprimirDatos(jsonData);
    
    }); 

I’ve also got this meta tag in the HTML:

<meta http-equiv="X-UA-Compatible" content="IE=11" />

I’ve tried by changing it to “IE=edge” and “Chrome=1” but it’s not working.

<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

I would assume that you also tried above, right?

Hi, yes I did. That’s why I made this question. I don’t know what else to do. :confused:

then I would suggest to go ahead with a Polyfill RnD or to rethink if you have an alternate to achieve what you want to achieve. Currently we don’t know the goal of your intententions.

As you already concluded in your question, ES6 is not available in UiPath. You must be ES5 compatible i.d. use XMLHttpRequest with synchronous mode (UiPath does not wait for async request). For instance:

function (e,apiURL) {
     var responseData;
     var asyncMode = false;

    // Create XMLHttpRequest object.
    var xhr = new XMLHttpRequest(); 
    
    // Initialize It.
    xhr.open("GET", apiURL, asyncMode);

    // Send HTTP request.
    xhr.send();

    // If OK
    if (xhr.status === 200) {
       responseData = xhr.responseText;
    } else {
       responseData = "Got error: "+xhr.statusText;
    }

    // Return output string
    return responseData;
}