I have checked the official sentry docs and I have also checked out some other references but I can't find a solution...
Basically I am trying to install sentry in my browser extension.
So in my background.js I have done the following
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: '...'
});
but... this isn't doing anything? - and it also seems to stop the rest of my code working, for example:
I have the following code in my background.js
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.status === 'complete') {
currentTab = tab;
console.log(tab);
}
});
Now If I comment out the sentry init this code works as expected, but as soon as I put the sentry init back in, this code no longer runs.
I'm getting no errors, and I can't find any real examples of how to implement sentry with a browser extension. Now I know it's possible but I'm clearly doing something wrong?
I seem to have found the solution to my problem I was using a webpack to bundle my chrome-extension with required dependencies. Webpack was generating a vendor.js file which contained all the imported dependencies. In my case, the mistake I did was not adding that file the as scripts in the manifest.json file.
...
"background": {
"matches": ["https://*/*"],
"scripts": ["js/vendor.js","js/background.js"],
"persistent": true
},
...
This resolved the issue as the dependencies are now loading correctly.