keen / keen-js

https://keen.io/ JavaScript SDKs. Track users and visualise the results. Demo http://keen.github.io/keen-dataviz.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read property 'join' of undefined

Jank1310 opened this issue · comments

commented

I wanted to use keen-js with Meteor 1.3.3.1 for tracking events in the browser but addEvent fails with:

superagent-request-types.js:48: Uncaught TypeError: Cannot read property 'join' of undefined

for

client.addEvent('test', {'test':'1234'}, (err, res) => {
    console.log('result', err, res);
});

I looked at the superagent-request-types.js file and noticed that self._query is undefined. Adding a guard helps and the event is successfully added to keen but the callback of addEvent is not called.

I'm not sure if the two problems (self._query undefined and callback not called) are related.
The library works without any problems on the server side.

@Jank1310 which version of keen-js are you using? This issue was addressed in v3.4.1 👍

commented

I'm using version 3.4.1.
Tomorrow I will try to reproduce the problem(s) with a clean Meteor project.

commented

I've created a clean Meteor project with keen-js and it still fails.

  • keen-js: 3.4.1 (latest)
  • meteor: 1.3.4 (latest)

You can find the repository here: https://github.com/Jank1310/meteor-keen-js-test

Keen-js is imported in client/main.js with

import Keen from 'keen-js';

I think Meteor somehow breaks the library on the client side...

Yeah, the underlying issue here (as we saw in earlier versions) is that Meteor uses the incorrect version of superagent, since it ships with both server and client code.

Our new standalone SDKs work just fine in Meteor, and come with a bunch of helpful goodies that make data modeling and app instrumentation easier than ever. Would you be interested in making the switch?

  • keen-tracking.js is a full drop-in replacement for keen-js, so there shouldn't be any problems switching that out.
  • keen-analysis.js has been reworked slightly to use promises, which can help quite a bit when wiring async query calls into your app. There are a few breaking changes, but they're all documented in the repo.
  • keen-dataviz.js is our visualization SDK powered by C3.js/D3.js, and has a ton of awesome improvements to both performance and styling. You can check out a quick demo here: http://keen.github.io/keen-dataviz.js/
npm install keen-tracking keen-analysis keen-dataviz --save
commented

Just added keen-tracking and it works perfectly, thank you for your help :-)

Awesome, happy to hear that @Jank1310! Ping me from that repo if you hit any snags 👍