amplitude/Amplitude-JavaScript

amplitude-js v3.7.0 breaks my CI build with an undefined reference

Closed this issue · 2 comments

Here's an excerpt from the traceback

node_modules/amplitude-js/amplitude.js:67
    var objectProto = Object.prototype,
                            ^
TypeError: Cannot read property 'prototype' of undefined
    at runInContext (node_modules/amplitude-js/amplitude.js:67:29)
    at Window.<anonymous> (node_modules/amplitude-js/amplitude.js:886:5)
    at node_modules/amplitude-js/amplitude.js:919:4
    at createCommonjsModule (node_modules/amplitude-js/amplitude.js:14:35)
    at node_modules/amplitude-js/amplitude.js:17:13
    at commonjsGlobal (node_modules/amplitude-js/amplitude.js:2:82)
    at Object.<anonymous> (node_modules/amplitude-js/amplitude.js:5:2)
    ...

This seems to happen at require, so I don't think that there's anything I can do about it. My tests are running under mocha with jsdom if that makes any difference.

Previously, my package.json had "amplitude-js": "^3.6.0". In order to resolve this issue for the time being, I've been forced to lock myself at the previous version ("amplitude-js": "=3.6.0") which is obviously not ideal.

It looks like the changes between 3.6 and 3.7 are pretty significant and do touch the lines that my build is complaining about.

Let me know if you need any further details.

Hi @mgilson-argo,

That's a weird error. I would have guessed jsdom was the issue, but I just managed to run some tests with jsdom 11.2.0 and I didn't run into this.

Any more details like what pre-processors and bundlers you are using might help.

@mgilson-argo Closing this one for now. Happy to keep investigating if you can share any more details of your build process.