I'm developing a scratch new chrome extension (one having only a service worker, using manifest version 3). Much of the time when I have its service worker crash due to my latest code addition, I find myself unable to get to a log / console view showing the crash reason. All I get is a dead link:
The hyperlink does not open the usual inspect view for the dead service worker. Alternatively, when I click the "Errors" button shown in the extensions view:
I just get "Service worker registration failed", but not any information about which line of code is causing the failure. Eventually I always find the error in my code by analytic means, but this really slows down my development iterations considerably. Is there a finer-grain view for this?
Manually opening the inspect view, there is nothing about the error to be found through the Console
Nor the Application
tabs of the inspect view.
Indeed after ticking the following option and reloading my extension ―
I do get a mention of my extension in this particular view ― after reloading my offending chrome extension ― but the details are less than revealing, as shown below:
It seems that wrapping the entire service worker code with a try catch surfaces the error details in some cases but not all.
Related Chrome issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1152202