Forge trigger Unexpected behavior

Hi Team,

I am working on a forge app which has a use case to do certain operations on the trigger function. The trigger is invoked on change in the assignee field.

As part of the function being called for the trigger, I have initially done console.log to print a statement, then called a 3rd party API to do a certain task which also logs a statement.

I was trying to understand how this would behave when bulk updates are done. As Jira allows maximum bulk update on 1000 issues, I did a bulk update on 1000 issues for the assignee field which should trigger 1000 times ideally.

I did the bulk update operation 3 times and the results which I obtained are as:

1st time => 933 console.log statements but for the external service called it was logged 1000 times.
2nd time => 945 console.log statements but for the external service called it was logged 1000 times.
3rd time => 940 console.log statements but for the external service called it was logged 1000 times.

Can someone guide why in each case, there are different counts of console.log statements?
Does it mean the function was not triggered for those or it was triggered but it was not logged?
Because external service was logged 1000 times, it means it was called 1000 times.
Why is this behaviour inconsistent? Can someone suggest how can we resolve this?

Hey @MehulPateliya,

I’m trying to understand the logic that you have inside your Forge app. Is the external call to 3rd party app being executed from the trigger method right after the console.log?

Could you share part of your manifest, where you declare the trigger and perhaps some code snippet of your trigger method when you do the console.log and 3rd party API call?

Regards,
Szymon

Hi @SzymonRekawek Thanks for replying
so here by manifest.yml code
modules:
jira:adminPage:
- key: test-hello-world-admin-page
function: main
title: Test
trigger:
- key: test-trigger
function: trig
events:
- avi:jira:updated:issue
function:
- key: main
handler: index.run
- key: trig
handler: index.trigger
app:

permissions:
scopes:
- read:jira-work
external:
fetch:
backend:

and trigger function code
export const trigger = async()=>{
const bodyData = { query: FETCH_SWIMLANES_QUERY };
const response = await apiEndPoint(
JSON.stringify(bodyData),
);
if(response.ok){
console.log(“OK”)
await sendLogs({message:“Ok”});
}
else{
console.log(“Failed”)
await sendLogs({message:“Failed”});
}
}
so here console.log is skipping some time but external calls always happening