cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EdgeConnect request failed due to unexpected response

Hi All, 

We are trying to execute the below as a Workflow JavaScript but when we run it we are getting the error 

Error: EdgeConnect request failed due to unexpected response from EdgeConnect dispatcher (status code: 400 Bad Request, error reason: {"error":{"code":400,"message":"Unexpected data!"}}).
at async Promise.all (index 0)
at async node:http:406:26

The IP / Hostname are in the  host patterns are configured.

When running the same code from the EdgeConnect server it returns successfully, 

Below is the code. 

const https = require('https');

const options = {
hostname: 'host',
port: 1234,
path: '/xxxx/_xxxx',
method: 'GET',
auth: 'username:password',
rejectUnauthorized: false // This will ignore SSL certificate errors
};

const req = https.request(options, (res) => {
console.log(`statusCode: ${res.statusCode}`);

let data = '';
res.on('data', (d) => {
data += d;
});

res.on('end', () => {
try {
const parsedData = JSON.parse(data);
const cleanedData = parsedData.hits.hits.map(hit => hit._source);

// Output the cleaned data to the console
console.log(cleanedData);
} catch (err) {
console.error('Error processing data:', err);
}
});
});

req.on('error', (error) => {
console.error(error);
});

req.end();

0 REPLIES 0

Featured Posts