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

Uncaught ReferenceError: SharedArrayBuffer is not defined #434

Closed
2 tasks done
wirtzdan opened this issue Jul 25, 2021 · 3 comments
Closed
2 tasks done

Uncaught ReferenceError: SharedArrayBuffer is not defined #434

wirtzdan opened this issue Jul 25, 2021 · 3 comments
Labels

Comments

@wirtzdan
Copy link

Prerequisites

  • I'm using the last version.
  • My node version is the same as declared as package.json.

Subject of the issue

I'm using metascraper in a Chrome extension. Recently the extension stopped working for a lot of users due to Chrome updating to version 92 and now requiring cross-origin isololation.

Expected behaviour

Normally, the extension should load just fine.

Actual behaviour

But with the recent Chrome update, I get the error: Uncaught ReferenceError: SharedArrayBuffer is not defined. A little bit of digging shows me that it's caused in jsdom, which is loaded by metascraper/helpers.

How to reproduce

It should be reproducible by loading any kind of temporary chrome extension that initialises metascraper and uses packages like the metascraper-author package.


Is this something that could be solved from your end? It's a known problem with jsdom, but it doesn't seem to be that case that they will fix it soon.

@Kikobeats
Copy link
Member

Kikobeats commented Jul 25, 2021

Thanks for reporting but I feel there is not too much I can do there.

The error is clear: SharedArrayBuffer should be defined in the environment you are running metascraper, and as you said, that's actually a thing that happened after a Chrome update (the environment where you are running metascraper)

Maybe could be an approach to be sure SharedArrayBuffer exists, or load a shim instead?

Also as an alternative, you can consume api.microlink.io. It runs metascraper under the hood, and the free API endpoint should be enough for little things (it has IP address rate limit)

@wirtzdan
Copy link
Author

Thanks for the quick response. I also thought this could be the case. But I still appreciate the help.

What do you mean by shim?

Regarding the API limit: When it's limited per IP, that means I technically would get 100 request for free per user per day? Did I get that right?

@Kikobeats
Copy link
Member

by shim means you can provide a SharedArrayBuffer as a global object for those scenarios where the object is undefined.

So you can monkey patch a global in order to resolve the issue. Something like this facebook/create-react-app#10474 (comment)

Regarding the API limit: When it's limited per IP, that means I technically would get 100 request for free per user per day? Did I get that right?

That's right. The current free API rate limit is just 50 req/s per day, but I will be happy to increment to 100 if that resolves your issue. In case the user needs more, the user can buy a plan and fill the API key to be attached as a header to the requests performed by the extension.

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

No branches or pull requests

2 participants