Sending self describing events with the nodejs tracker


#1

I’m trying to update a project of ours that uses the nodejs tracker to add schemas to the unstructured events. It started on 0.2.0 but the error I’m seeing comes through on both 0.2.0 and 0.3.0. At the moment I’ve using a test setup with a snowplow-mini collector on port 8080. The events are coming through but going to bad rows. The error message I’m seeing are always

{"level":"error","message":"Payload with vendor :8080 and version i not supported by this version of Scala Common Enrich"}

The line looks like base64 but it isn’t decoding well, perhaps it’s thrift? What I can see though make it look like the event is constructed correctly, well the ue_pr bit at least.

CwBkAAAACzEzLjExNC41LjIwCgDIAAABXXUFeu0LANIAAAAFVVRGLTgLANwAAAAQc3NjLTAuNi4wLXN0ZG91dAsBQAAAAAgvOjgwODAvaQsBSgAAAYxlPXVlJnVlX3ByPSU3QiUyMnNjaGVtYSUyMiUzQSUyMmlnbHUlM0Fjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3clMkZ1bnN0cnVjdF9ldmVudCUyRmpzb25zY2hlbWElMkYxLTAtMCUyMiUyQyUyMmRhdGElMjIlM0ElN0IlMjJzY2hlbWElMjIlM0ElMjJpZ2x1JTNBY29tLm1ldGFpbCUyRmtvcnRvdV9zdGFyX2ZlZWRiYWNrJTJGanNvbnNjaGVtYSUyRjEtMC0wJTIyJTJDJTIyZGF0YSUyMiUzQSU3QiUyMnJhdGluZyUyMiUzQTMlN0QlN0QlN0QmcD1zcnYmdHY9bm9kZS0wLjMuMCZ0bmE9cHJvZCZhaWQ9a29ydG91LWZiLWNoYXRib3QmdWlkPTkyNTQxMjkyMDkxODAwOSZsYW5nPWVuX0dCJmVpZD05Zjg0MzRjMC02YWY0LTRmZmQtODNkMC1lMDYwODdhZDFiOGUmZHRtPTE1MDA5MDY4NzY5NTIPAV4LAAAAAgAAABFDb25uZWN0aW9uOiBjbG9zZQAAABhIb3N0OiA1Mi4xNy4yMDYuMTA0OjgwODALAZAAAAANNTIuMTcuMjA2LjEwNAsBmgAAACQ1OTk3ODI5Mi1lM2FiLTQ3YTYtYmRkZi0xOWYzYTJjYjFhZTELemkAAABBaWdsdTpjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3cvQ29sbGVjdG9yUGF5bG9hZC90aHJpZnQvMS0wLTAA

The code to set up the tracker is

function TrackerFactory(deps, host, namespace, appId) {
  const snowplow = deps.snowplow;
  this.commonEmitter = snowplow.emitter(
    host,
    'http',
    8080,
    'GET',
    0,
    (err, response, body) => {
      if (err || response.statusCode !== 200) {
        console.error(`Snowplow request failed - err: ${err}, response: ${response}`);
      }
    }
  );
  this.tracker = snowplow.tracker;
  this.namespace = namespace;
  this.appId = appId;
}

I barely know any JavaScript but I did change the port from 80 to 8080 and I’m passing in the correct host. It’s working well enough to send the event.

This whole thing is running in a lambda function but I have managed to send a test event from a nodejs repl so any hints on how to see what the Snowplow tracker is sending would be great.


#2

Hello @gareth,

Please make sure your host variable has form of my-collector.com, i.e. does not have http:// prefix, :8080 port or /sompath URL in it.


#3

Thanks, I managed to revert the change I made to the collector URL before deploying my latest version. I had initially naively tried the JS tracker approach of putting the port in the collector URL.