My code in local works fine, but in Netlify it doesnot. Iam not sure whats happening. The flow is I generate invoices using easy invoice package and trying to upload it to s3 in async. But my code executes on the netlify platform wierdly.
generating invoice...
called in
◈ Done executing background function handler-background [here it actually exits, i think]
called out
My code is like this:
const generateInvoice = async (data) => {
let base64FileString = '';
try {
console.log("called in")
base64FileString = await createInvoice(data); (---> this is creating problems, internally it returns a promise)
console.log("called out")
} catch(e) {
console.log("Cannot create invoice ==> ", e)
return;
}
return base64FileString.pdf;
}
};
At the output, you can see the called in
is printed and then it exits
◈ Done executing background function handler-background
and again after some time, it print
called out
This happens only on netlify function:serve
(i.e) dev environment
But in Netlify platform it stops at the called in
Some help is appreciated.
Normal invoke of this function works properly (i.e) node <filename>
Any javascript issue here??