I am using a custom javascript activity that uses Node.JS found here: Javascript With Node.JS
I am able to get a response in UiPath if an error occurs, but the activity gets stuck when trying to return the event data. I confirmed the event was being triggered properly by returning a placeholder string instead of the event data and that worked without issue.
const EventSource = require('eventsource');
var endpoint = process.argv.slice(2);
const url = endpoint[0];
const eventSource = new EventSource(url);
eventSource.addEventListener("result", (event) => {
console.log('Result:', event.data);
eventSource.close();
});
eventSource.onerror = function (error) {
console.log("Error:", error.status, ":", error.message);
eventSource.close();
};
This is the code I am using and I pass the endpoint for the server sent event into the activity. I also did some testing with the ‘onopen’ event and was able to get a response when that event happened. My only issue seems to be with the custom ‘result’ event that is actually sending the data, however I am able to get log the value with my code in Visual Studio. Any ideas what is causing the activity to get stuck?
Thanks!