Are there any remaining issues with SS2.1 that has...
# suitescript
s
Are there any remaining issues with SS2.1 that has you still creating SS 2.0 scripts?
b
The only thing I don't like is how exceptions are throw. 2.0 exception objects had so many helpful details. You could just log the exception object like
log.error('error', JSON.parse(JSON.stringify(e)))
, and it would show so much. In 2.1, only two properties are available for exception objects:
message
and
stack
. Interestingly
stack
contains the message anyway. You can't just log the exception object with 2.1. You have to log the property that you want for it to show in the log like
log.error('error', e.stack)
. This makes me believe that the properties must be getters. This issue is no where near a roadblock though. Just a vary mild annoyance that is easy to workaround. Overall, I am really enjoying 2.1. I couldn't see myself going back.
s
Is everyone doing all new scripts in SS2.1 then?
b
I can only speak for myself. I am, yes.
s
really, wondering if I can finally have NFT target ES2019 instead of ES5 - effectively making it SS 2.1+ by default.
d
@burkybang recently converted some scripts to 2.1 myself and just noticed this difference...definitely odd/annoying. @stalbert another difference was the client script attached to Suitelet weirdness where the
context
isn't loading properly, I think you were on one of those threads. also, I was seeing different behavior surrounding attempting to use some minimal SuiteScript API outside of main entry point "public" functions , where was technically allowed in SS2 but now gets error "Fail to evaluate script: SuiteScript API Modules are unavailable while executing your define callback"
s
Yes, that traffic-cop rules for script evaluation became much more strict. Thanks for reminding me of that weird loading issues for client scripts. Was that ever resolved? Are you still doing new SS2.0 scripts because of any of these issues?
d
I saw some other chatter around it, latest I saw @SimonC posted it was defect#635679 and got upgraded to U5 level no, we decided to still upgrade everything to ss2.1 as a working solution, I ended up writing a future-proof wrapper function when getting the context to resolve the differences
b
@dbarnett Would you mind going into detail about the context issue you're mentioning? I can't say I've experienced anything like that.
d
essentially the bug is that when 2.1 Client script is attached to Suitelet via
clientScriptModulePath
, the context is loaded as if it were a 1.0 script instead - so it passes the context arguments in as such https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N2959270.html
b
Oh that's terrible
e
We’re using 2.1 for everything now.
e
@dbarnett Can confirm - Have ran into this a few times
m
I default to SS2.1 for anything new (and am gradually converting 2.0 scripts). I've only come across one issue with a Map/Reduce that would have random unexpected errors every time it ran. NetSuite support blamed a different system outage or SuiteApp every time I opened a case. Finally I converted to SS2.0 and errors disappeared.
s
thanks @michoel