TypeError: __webpack_require__.g.ActiveXObject is not a constructor
See original GitHub issueI use centrifuge to connect to DonationAlerts server and everything works fine until I get to 3rd step where Centrifuge has to send POST ajax request to DA endpoint in order to get channel subscription token.
This is my code:
centrifuge.subscribe('$alerts:donation_235774', function(message) {
console.log('new message', message)
});
And I get error:
TypeError: __webpack_require__.g.ActiveXObject is not a constructor
at Centrifuge._ajax (/fakepath/node_modules/centrifuge/dist/centrifuge.js:193:101)
at Centrifuge.stopSubscribeBatching (/fakepath/node_modules/centrifuge/dist/centrifuge.js:2329:24)
at Centrifuge._subscribe (/fakepath/node_modules/centrifuge/dist/centrifuge.js:1392:16)
at Subscription.subscribe (/fakepath/node_modules/centrifuge/dist/centrifuge.js:2786:24)
at Centrifuge.subscribe (/fakepath/node_modules/centrifuge/dist/centrifuge.js:2351:11)
at subscribeToDonations (/fakepath/cen.js:27:14)
at Centrifuge.<anonymous> (/fakepath/cen.js:20:3)
at Centrifuge.emit (/fakepath/node_modules/centrifuge/dist/centrifuge.js:3089:5)
at Centrifuge._connectResponse (/fakepath/node_modules/centrifuge/dist/centrifuge.js:1550:12)
Looks like it only happens when channel name starts with $ character.
I tried alerts:donation_235774
, news
— no errors. But as soon as I add $ before anything — it breaks. Also tried aasd$asdas
and no errors thrown.
OS: MacOS Big Sur 11.0.1 Version of Centrifuge-js: 2.7.5 NodeJS version: v15.2.1 NPM version: 7.0.10 I use WebSockets for nodejs, also tried with sockjs and it couldn’t even connect to server
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
webpack imported module is not a constructor - Stack Overflow
For me, this error was caused by importing through index files. I had multiple directories with their index.ts files that exported all the...
Read more >TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >59.94% (199 / 332) Functions: 86.49% (333 / 385) Lines
toEqual(true); }); // TODO Blob is not a constructor in PhantomJS // it('should validate Blob', function () { // expect(utils.isBlob(new Blob())).
Read more >webpack/webpack - Gitter
Hi everyone, I'm trying to move my old amd module based library to esm & also from grunt to webpack. I'm using this...
Read more >JavaScript Error Handling - X Is Not a Constructor TypeError
A deep dive into the X Is Not a Constructor TypeError within JavaScript, including a quick overview of constructors with simple code ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Cool, looks like we need to add explicit option to pass it into Centrifuge like we have with WebSocket and mention in readme.
Thanks! Works perfect