arnoudkooi / ServiceNow-Utils

Browser Extension to enhance experience and productivity in ServiceNow
https://arnoudkooi.com
243 stars 115 forks source link

SN Utils runs forever in BackgroundScript #475

Closed iCode18 closed 6 months ago

iCode18 commented 6 months ago

Anybody know how to fix SN Utils BG in Washington, mine is weird after the upgrade as shown in the screenshot it missed the VS code theme and functionality and even though a smal test like gs.info("Hello SN"); runs none-stop. Sorry if this is asked before but I did not found link or solution.

arnoudkooi commented 6 months ago

Not seeing a screenshot....

iCode18 commented 6 months ago

image

arnoudkooi commented 6 months ago

can you check console for error?

iCode18 commented 6 months ago

Initializing Database! 857e62d76f2b764061f06ea22e3ee491.cssdbx:1

   Failed to load resource: the server responded with a status of 404 (Not Found)

SweetAlerts2-min.jsdbx:1

   Failed to load resource: the server responded with a status of 404 (Not Found)

sys.scripts.modern.do:482 Uncaught SyntaxError: Unexpected identifier 'minHeight' xperf_timing.jsx?v=02-02-2024_1052:12 +-- Parse times xperf_timing.jsx?v=02-02-2024_1052:13 | CSS parse: 47.599999994039536 xperf_timing.jsx?v=02-02-2024_1052:14 | JS doctype: 147.80000000447035 xperf_timing.jsx?v=02-02-2024_1052:15 | JS at end of page: 10.400000005960464 xperf_timing.jsx?v=02-02-2024_1052:16 +-- All parsing: 205.80000000447035 js_includes_amb.jsx?v=02-02-2024_1052&lp=Sun_Feb_18_11_49_57_PST_2024&c=33_965:2 amb.ServerConnection [INFO] _initializeSubscriptionCommandSender: SubscriptionCommandSender is enabled js_includes_amb.jsx?v=02-02-2024_1052&lp=Sun_Feb_18_11_49_57_PST_2024&c=33_965:2 amb.TransportManagement [INFO] Connected using transport websocket js_includes_amb.jsx?v=02-02-2024_1052&lp=Sun_Feb_18_11_49_57_PST_2024&c=33_965:2 amb.TransportManagement [INFO] Removed failed registry transports after connect: {} bgscriptmodern.js:142 Uncaught TypeError: Cannot read properties of undefined (reading 'addAction') at snuEnhanceMonaco (bgscriptmodern.js:142:9) at bgscriptmodern.js:24:2 857e62d76f2b764061f06ea22e3ee491.cssdbx:1

   Failed to load resource: the server responded with a status of 404 (Not Found)
iCode18 commented 6 months ago

image

arnoudkooi commented 6 months ago

Could you run the below in console and share the result (screenshot)?

console.log(window.monaco.editor.getEditors()[0]);
console.log(GlideEditorMonaco.get('script').editor);
iCode18 commented 6 months ago

Could you run the below in console and share the result (screenshot)?

console.log(window.monaco.editor.getEditors()[0]);
console.log(GlideEditorMonaco.get('script').editor);

image

arnoudkooi commented 6 months ago

This seems to be an instance related problem, as the Monaco editor does not get applied, even when you disable SN Utils. I recommend logging a support case.

I'll leave it open please update when you know more.

iCode18 commented 6 months ago

Some updates from ServiceNow: When we set the glide.ui.syntax_editor.polaris=false, it switches the script editor from Monaco Editor to CodeMirror. Unfortunately, the code editor toolbar on sys.scripts.modern.do does not work with CodeMirror.

Setting glide.ui.syntax_editor.polaris=true will switch the script editor back to Monaco Editor and the code editor toolbar will work properly on sys.script.modern.do.

There is an issue with Jelly code not handling escape characters properly on this instance and dev team is working on fixing the same. I will keep you posted further once its fixed.

iCode18 commented 6 months ago

ServiceNow dev team added a new record to sys_ui_macro This new record is a macro and it is replacing double quotes by single quotes on editor_monaco_init_script.xml to fix missing escape characters due to missing JS prefix as mentioned on https://docs.servicenow.com/bundle/washingtondc-api-reference/page/script/server-scripting/reference/r_JellyEscapingTypes.html

This fixed everything so far except the VS code theme.

arnoudkooi commented 6 months ago

As this is confirmed to be an instance issue, Im closing this. Thanks for the updates and feel free to add solution when it is fixed.