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

Buffer 4.9.2 refers to global which is a node-only feature. #326

Open
Arlen22 opened this issue May 22, 2023 · 1 comment
Open

Buffer 4.9.2 refers to global which is a node-only feature. #326

Arlen22 opened this issue May 22, 2023 · 1 comment

Comments

@Arlen22
Copy link

Arlen22 commented May 22, 2023

It seems that Buffer 4.9.2, which is explicitly a browser polyfill, tries to access a global variable, which as far as I can tell, is only available on Node. Why I haven't run into this before today I can't tell, but suddenly an Angular project I'm working on starting having trouble with this. It goes through the amazon-cognito-identity-js dependancy, which even in the latest version explicitly requires 4.9.2. I don't know why this suddenly happened, and I guess with 13 million downloads it probably isn't a bug, but I don't really know what's going on.

@lukemcgregor
Copy link

lukemcgregor commented Sep 26, 2023

Yeah this seems ridiculous to me, surely

Buffer.TYPED_ARRAY_SUPPORT = global && global.TYPED_ARRAY_SUPPORT !== undefined
  ? global.TYPED_ARRAY_SUPPORT
  : typedArraySupport()

or

Buffer.TYPED_ARRAY_SUPPORT = window.TYPED_ARRAY_SUPPORT !== undefined
  ? global.TYPED_ARRAY_SUPPORT
  : typedArraySupport()

would make more sense here.

Amplify recommends using a polyfill of

window.global = window;

But this seems like adding fuel to the fire here.

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

2 participants