I have a library script that uses the runtime. If...
# suitescript
I have a library script that uses the runtime. If I call runtime.EnvType, it errors saying
Details: Fail to evaluate script: All SuiteScript API Modules are unavailable while executing your define callback
when I try and upload a file (already created) that references this library file. Anyone seen this before or know how to get around it? It works as long as I don't actually call the runtime module
Copy code
function getEnvironment() {
        log.debug("envtype", runtime.EnvType)

    return {
        DEV: 'SANDBOX',
        TEST: 'UAT',
This error I've found typically occurs when you are trying to do something like set some globals in your script outside of entry points. If that is the case, just add some logic to initialize the globals inside the entry point.
It isn't through which is weird. Unless it's on the N/runtime module