hi all, I'm trying to run this suitelet to export ...
# suitescript
s
hi all, I'm trying to run this suitelet to export excel using exceljs. But I have this line, it runs through this promise function and I got stuck. Log 'ok2' is not showing in Excution Log. Any Idea for this? Thanks a lot!!!
n
Do you see any errors logged? Do you have logs before that line above your log.debug? Do you have your script deployment set to "DEBUG" error logging level? Are you catching an error prior to this point potentially masking anything being logged? You may have to show more than that snippet. If you do, make it easier for folk please and post as code and not an image. you can use the "</>" icon on the edit panel to make it easier to read.
👍 1
s
var buf = wb.xlsx.writeBuffer();
log.debug('ok', buf);
buf.then(function(buf) {
log.debug('ok2');
})
log.debug('ok3');
basically i'm using this function from exceljs library
and I also have this log
can you see that
it steps over 'ok2', no try catch here
so I guess no error at all
normally in js, this function uses as async await but I cannot upload script with async await to netsuite. It occurs an error
Copy code
const buffer = await workbook.xlsx.writeBuffer();
https://github.com/exceljs/exceljs
n
Where is your log in your code that has "wb" as the title? Also are you doing this in a client script attached to the SuiteLet or is this code directly in your SuiteLet, I'm not sure you can do what you're trying directly in a SuiteLet, not that I've ever tried...
s
I try Client Script and It works well but I need it run directly in a Suitelet. Because it needs to run as Administrator role
n
Yeah I don't think that's possible but maybe someone else can advise.
👍 1
s
thanks anyway
b
the usual recommendation is SheetJS
if you want to keep trying exceljs, then you need to start catching your rejected Promises
👍 1
there is no mechanism in suitescript to globally handle rejected Promises
s
thanks @battk I will try