Action button's script time out issue

Hi there,
We are facing script time out issue. We are using script to call an external api and after success response updating the entity but some times script giving error of time out. please help me or suggest me solution for that.

Hi, @Niraj_Chourasia

Thanks for letting us know about the issue. Looks like the problem is in time response of external api over HTTP. I will check our request timeout settings in order to increase it if possible. In meantime, could you please also share your code without any credentials, auth or sensitive information? Probably we will figure out the way to optimise it.

Will keep you informed.

Thanks,
Oleg

1 Like

Hi Oleg,
Thanks for reply and looking into this matter. here is the code that we are using

script code start

// Fibery API is used to retrieve and update entities
const fibery = context.getService(‘fibery’);

// affected entities are stored in args.currentEntities;
// to support batch actions they always come in an array
for (var entity of args.currentEntities) {
// an entity contains all fields apart from collections;
// to access a field refer to it by its UI name
var creationDate = entity[‘Creation Date’];
var Name = entity[‘Name’];
var EntityId = entity[‘id’];
var Type = entity[‘Type’];
// to get collection fields query the API and provide the list of fields
// const entityWithExtraFields = await fibery.getEntityById(entity.type, entity.id, [‘Assignees’, ‘Files’]);
}

const http = context.getService(‘http’);
const filename = ${new Date().toISOString().slice(0, 10)}-${Name }.pdf;

var formationDate = new Date();
formationDate.setDate(formationDate.getDate() + 1);
const monthNames = [“January”, “February”, “March”, “April”, “May”, “June”,
“July”, “August”, “September”, “October”, “November”, “December”
];
creationDate = ${monthNames[formationDate.getUTCMonth()]} ${formationDate.getDate()}, ${formationDate.getUTCFullYear()};

const response = await http.postAsync(‘https://connect.pabbly.com/workflow/sendwebhookdata/xxxxxx_3D’, {
body: { creationDate , Name, EntityId },
headers: { ‘Content-type’: ‘application/json’ }
});

let document = JSON.parse(response);
//uploadd file to entity
await fibery.addFileFromUrl(
document[2].pdfUrl,
filename,
Type,
EntityId,
null
);

Hope you will find it and suggest solution.

Hi, @Niraj_Chourasia

Thanks for the code. It helps a lot. We increased timeout for file for url action and improved file uploading. Please let me know if the issue still can be reproduced.

Thanks,
Oleg