percolatestudio / meteor-segment.io

Basic Segment.io loader snippet Meteor package
29 stars 22 forks source link

AssertionError #27

Open mrcwinn opened 9 years ago

mrcwinn commented 9 years ago

Using Meteor 1.1.0.2 and package 1.2.2_1

As soon as I attached a simple analytics.page() call to Router.autoRun every request triggers an AssertionError.

W20150718-09:00:01.211(-7)? (STDERR) AssertionError: You must pass a message object.
W20150718-09:00:01.212(-7)? (STDERR)     at validate (/Users/USER/.meteor/packages/percolatestudio_segment.io/.1.2.2_1.juovpg++os+web.browser+web.cordova/npm/node_modules/analytics-node/lib/index.js:219:3)
W20150718-09:00:01.212(-7)? (STDERR)     at Analytics.page (/Users/USER/.meteor/packages/percolatestudio_segment.io/.1.2.2_1.juovpg++os+web.browser+web.cordova/npm/node_modules/analytics-node/lib/index.js:102:3)
W20150718-09:00:01.212(-7)? (STDERR)     at [object Object].Router.route.waitOn (app/routes.js:21:13)
W20150718-09:00:01.212(-7)? (STDERR)     at packages/iron:router/lib/router.js:277:1
W20150718-09:00:01.212(-7)? (STDERR)     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
W20150718-09:00:01.212(-7)? (STDERR)     at [object Object].hookWithOptions (packages/iron:router/lib/router.js:276:1)
W20150718-09:00:01.212(-7)? (STDERR)     at boundNext (packages/iron:middleware-stack/lib/middleware_stack.js:251:1)
W20150718-09:00:01.212(-7)? (STDERR)     at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
W20150718-09:00:01.212(-7)? (STDERR)     at packages/meteor/dynamics_nodejs.js:121:1
W20150718-09:00:01.212(-7)? (STDERR)     at [object Object].dispatch (packages/iron:middleware-stack/lib/middleware_stack.js:275:1)
zol commented 9 years ago

Could you please attach a link to a repo with a reproduction? No one else has reported this issue.

billyvg commented 9 years ago

We're having the same problem, I believe it's related to analytics-node, the APIs for their client and server APIs are different.

On server it expects an object with the event property as its only parameter.

analytics.track({
  userId: '019mr8mf4r',
  event: 'Purchased an Item',
  properties: {
    revenue: 39.95,
    shippingMethod: '2-day'
  }
});

vs

analytics.track('Signed Up', {
  plan: 'Startup',
  source: 'Analytics Academy'
});
sferoze commented 8 years ago

I got the same issue. @billyvg your answer is correct. Tracking on the server has a slightly different API. The docs should mention this.

dgroch commented 8 years ago

Yep. Server side uses syntax for [https://segment.com/docs/libraries/node/](NodeJS Library)

khaledkbadr commented 8 years ago

I have the same issue, can you tell me how did you solve it?

dominikmayer commented 8 years ago

The problem is also present with the identify method.

How about the package exposes a method that would then use Meteor.isServer to decide, how to pass the data on to analytics.js or analytics-node?

ashok-sc commented 6 years ago

I'm still getting this error when using the track method. Is this still an open bug? I'm using analytics-node npm package.