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

Unable to handle errors when loading the Google JavaScript Library #74

Open
pjnicolas opened this issue Oct 15, 2024 · 3 comments
Open

Comments

@pjnicolas
Copy link

A few users are encountering a "Failed to load the Google 3P Authorization JavaScript Library" error on my app. This error is being captured by Sentry, and it appears that the library isn't handling or responding to the error appropriately.

Here's the relevant code snippet from this library:

export const loadGApi = () => new Promise<types.Google>((resolve, reject) => {
    // [...]

    script.addEventListener("error", () => {
      reject("Failed to load the Google 3P Authorization JavaScript Library.");
    });

    // [...]
});

export const googleSdkLoaded: types.GoogleSdkLoaded = (action) => {
    // [...]

    loadGApi().then((google) => {
      action(google);
    });
    // No catch block or promise handling here, leading to an unhandled rejection in the browser.

    // [...]
};

Is this behavior expected? If not, is there any temporary workaround to handle this error more gracefully?

@nielsvhb
Copy link

I am having the exact same problem. Sentry tells me this issue is quite common. Did you find anything so far?

@pjnicolas
Copy link
Author

No, I just ignored the error on Sentry while I'm migrating to another tech stack.

@RobbeRls
Copy link

Created pull request #77 for this issue this could allow you to pass an error property into the install to handle the exception yourself.

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

3 participants