Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant report errors from a chrome extension? #453

Closed
mikecann opened this issue Apr 23, 2022 · 1 comment
Closed

Cant report errors from a chrome extension? #453

mikecann opened this issue Apr 23, 2022 · 1 comment

Comments

@mikecann
Copy link

Hi im trying to setup raygun in my chrome extension.

It works from a website fine but for some reason not in the extension.

Im using the npm version of raygun4js.

At first I thought it was somehow filtering it out thanks to this line:

if (Raygun.ErrorUtilities.isBrowserExtensionError(stackTrace)) {

But when I added some debug console lines around it I found out that its not event getting to that part and is instead exiting the function here:

return;

It appears that the _providerState !== ProviderStates.READY .. any idea why this might be? Im not getting any errors from raygun despite having set debugMode: true perhaps this is because I set debugMode: true AFTER the init error?!

@mikecann
Copy link
Author

mikecann commented Apr 23, 2022

After more node_modules/raygun4js/dist/raygun.umd.js spelunking I managed to track it down and get it working.

It appears that there is an order of operations issue happening where onLoadHandler is looking for apiKey to be set but it hasnt by that point so rg.init never gets called.

I fixed this by manually initting:

 const instance = rg4js("getRaygunInstance") as any;
    if (instance)
      instance.init(
        config.BT_RAYGUN_API_KEY,
        {
          ignore3rdPartyErrors: false,
          debugMode: true,
        },
        null
      );

hacky but works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant