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

yet-another-abortcontroller-polyfill throwing TypeError: Illegal constructor #34296

Closed
2 tasks done
aaronadamsCA opened this issue Dec 20, 2021 · 3 comments
Closed
2 tasks done
Labels
stale? Issue that may be closed soon due to the original author not responding any more. topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) type: bug An issue or pull request relating to a bug in Gatsby

Comments

@aaronadamsCA
Copy link
Contributor

aaronadamsCA commented Dec 20, 2021

Preliminary Checks

Description

Our error logs are filling up with "TypeError: Illegal constructor". The problem started when we upgraded from Gatsby v4.2.0 to v4.4.0.

We managed to trace the message's origin to this line of code:

https://github.com/benlesh/abort-controller-polyfill/blob/b40db6f1274a24bc7bc404339efe64a5012b3e78/index.js#L12

Which recently became part of Gatsby in #33530 here:

import "yet-another-abortcontroller-polyfill"

In addition to legacy browsers, we're seeing this error reported by Safari 13-14, Chrome 83-86, and Firefox 83, none of which I would expect to run the polyfill at all.

I downloaded Firefox 57 to reproduce the error. What I learned:

  • Simply calling new AbortController() is enough to cause the error to be thrown.
  • The problem crashes our site, due to other libraries (e.g. Apollo Client) using the faulty polyfill when it becomes available.

I would suggest removing the polyfill and simply not aborting requests in older browsers.

Reproduction Link

https://www.gatsbyjs.com/ using Firefox 56

Steps to Reproduce

Open the site

Expected Result

Site loads normally

Actual Result

Site throws TypeError: Illegal constructor.

  • On its own this error isn't enough to crash a website, but when other libraries depend on AbortController as well, they can crash. Apollo Client is an example.
  • Since the polyfill is broken, the abort functionality isn't working anyway.

Environment

Gatsby 4.4.0.

Config Flags

No response

@aaronadamsCA aaronadamsCA added the type: bug An issue or pull request relating to a bug in Gatsby label Dec 20, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 20, 2021
@aaronadamsCA
Copy link
Contributor Author

FYI @wardpeet - the AbortController polyfill introduced in #33530 is throwing an exception whenever it's used. Didn't want to @ you right before Christmas, but now that we're on the other side I'm letting you know!

@LekoArts LekoArts added topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Apr 13, 2022
@github-actions
Copy link

github-actions bot commented May 3, 2022

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label May 3, 2022
@aaronadamsCA
Copy link
Contributor Author

I am reasonably confident this has resolved itself, @wardpeet, possibly from #33731.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants