Comments (4)
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.
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.
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.
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)
- [OPTIMIZELY] - ERROR crypto$1.randomBytes is not a function HOT 3
- please change your code to throw in error conditions rather than return null HOT 5
- TypeError: randomBytes is not a function HOT 4
- Standardize consistent usage of `public` data modifier for public methods HOT 2
- Add flavor-specific package entry points for browser, node, lite, and react-native variations HOT 1
- Typescript - Breaking changes in 4.9.2 HOT 6
- Reporting a vulnerability HOT 1
- Consider enforcing import order via Prettier HOT 1
- node_request_handler.ts does not support HTTP HOT 1
- Improve OptimizelyConfig instantiation performance HOT 12
- Optimizely SDK keeps making datafile requests in NextJS Server Side
- [BUG] Test bug report HOT 1
- [BUG] Several typescript errors in 5.0.0-beta3 HOT 3
- issue: Incorrect client engine detected HOT 4
- [BUG] website points to a 404 for the changelog HOT 2
- [ENHANCEMENT] update the typing for getFeatureVariable to reflect what the docs say will be returned HOT 7
- [ENHANCEMENT] update readme to explain what parts are "legacy" HOT 2
- [ENHANCEMENT] Provide TypeScript types for feature experimentation API responses HOT 3
- [BUG] Upgrade to 4.10.0 causes createInstance to return null on cloudflare workers HOT 3
- sending SDK to createInstance() in Server-side context causes memory leaks HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascript-sdk.