browserify / crypto-browserify

partial implementation of node's `crypto` for the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS JS SDK Fails with this dependency

ch3ck opened this issue · comments

Some how the AWS JS SDK uses this package and in rng.js which I don't seem to find anymore in this source code creates an undefined variable for _global which we fixed with this:
var_global = this || window || {};

You can find more issues related to this package here:

  1. aws/aws-sdk-js#1512
  2. aws/aws-sdk-js#1566

Where the full source for this package so I can write a patch for this fix?

the error is in randombytes but the real issue is that this was written for browserify/webpack with the assumption that there will be a variable named 'global' and thus bundling this with certain webpack configurations will break that assumption

I don't know really know why the @aws team used this package, but how do we patch in this fix? we could add the statement above to make the check and skip otherwise. It's broken so many people's code. Spent the whole day yesterday trying to figure out why my code was not working.

@calvinmetcalf we could || window it. Though, it does sound like a problem with their build process, not us.

ok I just went and looked at the actual library, and we don't use the rng.js file anymore so this is almost certainly an issue with a really out of date version of this library

Where can I find the latest version of the library, I think I'll need to create an issue with the AWS sdk people to update the libary.

that's weird because I just installed the latest version from yarn except it doesn't have the latest version. However, I just filed some issues with them to see if they can get this resolved.

what are you using to bundle the library and have you tried removing your yarn.lock

I'm using webpack and I've reinstalled all the packages, and the currently supported crypto-browserify version is 1.0.9 seems like this needs to be updated. I don't really know the current version now.

3.12.0

I've added a PR to the amazon-identity package.