Will probably need to see more of your code, but I...
# suitescript
e
Will probably need to see more of your code, but I imagine
document
will only be available when running in the browser. Running from the debugger, there will not be any DOM defined. Are you trying to reference the DOM somewhere in your own code?