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

[BUG] Uncaught ReferenceError in Firefox with v5.0.13 #2111

Closed
the-nerbs opened this issue Jan 26, 2023 · 0 comments · Fixed by #2112
Closed

[BUG] Uncaught ReferenceError in Firefox with v5.0.13 #2111

the-nerbs opened this issue Jan 26, 2023 · 0 comments · Fixed by #2112

Comments

@the-nerbs
Copy link

Describe the bug
Altair 5.0.13 from the npm package does not load in Firefox.

To Reproduce

  1. Open Firefox and navigate to https://altair-gql.sirmuel.design/
  2. Observe the Altair logo is displayed, but the client IDE does not load.
  3. Open the developer console, and observe that an error is logged:
    Uncaught ReferenceError: chrome is not defined
        45147 https://altair-gql.sirmuel.design/main.js:1
        r https://altair-gql.sirmuel.design/runtime.js:1
        <anonymous> https://altair-gql.sirmuel.design/main.js:1
        n https://altair-gql.sirmuel.design/runtime.js:1
        <anonymous> https://altair-gql.sirmuel.design/main.js:1
        45147 https://altair-gql.sirmuel.design/main.js:1
        r https://altair-gql.sirmuel.design/runtime.js:1
        <anonymous> https://altair-gql.sirmuel.design/main.js:1
        n https://altair-gql.sirmuel.design/runtime.js:1
        n self-hosted:1406
        <anonymous> https://altair-gql.sirmuel.design/main.js:1
    

A second error is also logged (ReferenceError: AltairGraphQL is not defined), but this may just be a consequence of the previous error.

Expected behavior
The Altair client IDE loads without issue.

Screenshots
image

Desktop:

  • OS: Linux Mint 20.3 (through Virtual Box 6.1)
  • Browser Firefox 109.0
  • Platform: npm package
  • Version 5.0.13

Additional context

  • Loading the page on Chrome works without any issues, as does the Firefox extension.

  • I started seeing this through the graphql-dotnet server's Altair UI package (repo: https://github.com/graphql-dotnet/server) a couple days ago. They load the latest Altair package from jsdelivr (https://cdn.jsdelivr.net/npm/altair-static/build/dist).

  • The dev tools point me to the expression !!chrome?.runtime?.id as being what ultimately raises the error. In the diffs against the previous version, I see a change added this expression to packages/altair-app/src/app/modules/altair/utils/index.ts, which seems like a likely culprit:

    - export const isExtension = !!(
    -   (window as any).chrome &&
    -   (window as any).chrome.runtime &&
    -   (window as any).chrome.runtime.id
    - );
    + export const isExtension = !!chrome?.runtime?.id;

    diffs: v5.0.12...v5.0.13#diff-aa95ab08f850063e601922f39c0341abf97355333648539bd4984d211c918461

Nikhil7174 added a commit to Nikhil7174/altair that referenced this issue Jan 30, 2023
imolorhe added a commit that referenced this issue Jan 31, 2023
* Reverted the changes which possibly has caused error #2111

* Update packages/altair-app/src/app/modules/altair/utils/index.ts

---------

Co-authored-by: Samuel <samuelimolo4real@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant