Giter VIP home page Giter VIP logo

Comments (4)

tylerbrandt avatar tylerbrandt commented on June 2, 2024

Hi @deantoni, thanks for letting us know about this issue! It looks like you are using the legacy optimizely-client-sdk package; is that right? We recommend you try upgrading to @optimizely/optimizely-sdk and see if that resolves it (note that there is a minor breaking change in particular usage of the track API).

If that is not an option for you, can you let us know the exact version you are using in your package.json/package.lock? Also, if it's possible, could you provide a minimal package.json/steps that reproduces the issue?

from javascript-sdk.

vdeantoni avatar vdeantoni commented on June 2, 2024

Hey,

As part of upgrading our app to angular 6, the optimizely dependency was also updated to:
"@optimizely/optimizely-sdk": "^2.1.0"

Weren't you able to repro this issue? I will see if I can setup a simple project with angular 6 and the optimizely SDK so you can take a look.

from javascript-sdk.

spencerwilson-optimizely avatar spencerwilson-optimizely commented on June 2, 2024

Hey @deantoni , I checked out v2.1.0, ran npm run build-browser, and looked at the rng code in the resulting bundling. I saw:

/***/ }),
/* 71 */
/***/ (function(module, exports) {

// Unique ID creation requires a high quality random # generator.  In the
// browser this is a little complicated due to unknown quality of Math.random()
// and inconsistent support for the `crypto` API.  We do the best we can via
// feature-detection

// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues.bind(crypto)) ||
                      (typeof(msCrypto) != 'undefined' && msCrypto.getRandomValues.bind(msCrypto));
if (getRandomValues) {
  // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
  var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef

  module.exports = function whatwgRNG() {
    getRandomValues(rnds8);
    return rnds8;
  };
} else {
  // Math.random()-based (RNG)
  //
  // If all else fails, use Math.random().  It's fast, but is of unspecified
  // quality.
  var rnds = new Array(16);

  module.exports = function mathRNG() {
    for (var i = 0, r; i < 16; i++) {
      if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
      rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
    }

    return rnds;
  };
}

No references to global :\ As @tylerbrandt noted, your original stack trace looks as though it was made with an old release of the SDK (and a different package, as a matter of fact; the SDK package was renamed to @optimizely/optimizely-sdk with version 2.0.0 in mid April).

As a best-effort, I fetched the last release of optimizely-client-sdk (the old package) and checked its dist/optimizely.js. That module does refer to global, but Chrome 66 doesn't seem to have any trouble evaluating that module.

Could you try upgrading to the latest release of the @optimizely/optimizely-sdk and provide a new stack trace, if you're still having the issue?

from javascript-sdk.

vdeantoni avatar vdeantoni commented on June 2, 2024

Hey Guys,

Thanks for looking into it. When I have some free cycles I'll give this another try. The polyfill works fine for now.

Thanks again.

from javascript-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.