Error while processing Node.js events (Python works fine)

Greetings
I am trying to set up Snowplow by using Scala Stream Collector and Stream Enrich. For the tracking part, I am testing both Python and Node.js trackers. I am running a simple “track link click” on both applications.
Turns out the Python trackers work fine, with the event being processed by both Kinesis streams that collect and enrich it. But when I try to run the same on Node.js, I get an error between the collector and the enricher:

“errors”:[{“level”:“error”,“message”:“error: object instance has properties which are not allowed by the schema: [“headers”]\n level: “error”\n schema: {“loadingURI”:”#",“pointer”:""}\n instance: {“pointer”:""}\n domain: “validation”\n keyword: “additionalProperties”\n unwanted: [“headers”]\n"},{“level”:“error”,“message”:“error: object has missing required properties ([“schema”])\n level: “error”\n schema: {“loadingURI”:”#",“pointer”:""}\n instance: {“pointer”:""}\n domain: “validation”\n keyword: “required”\n required: [“data”,“schema”]\n missing: [“schema”]\n"}]

I tried changing the Iglu resolver file, I tried to use enrichments, I tried to change the event that was tracked but nothing helped. This is the app that I’m trying to run, which is just a button with a click counter. Are the trackers set up correctly?

import React, { Component } from ‘react’;

const snowplow = require(‘snowplow-react-native-tracker’);

export default class App extends Component {
constructor(props) {
super(props);

	var emitter = snowplow.Emitter;
	var tracker = snowplow.Tracker;

	const e = emitter(
		{
			endpoint: '0.0.0.0:8080', // Collector endpoint
			protocol: 'http', // Optionally specify a method - http is the default
			method: 'POST', // Method - defaults to GET
			bufferSize: 1, // Only send events once n are buffered. Defaults to 1 for GET requests and 10 for POST requests.
		},
		(response) => {
			console.log(response);
		},
	);

	global.t = tracker({ emitters: [e], namespace: 'namespace-x', appId: 'xyz', encodeBase64: false });

	global.t.setPlatform('web');
	global.t.setUserId('id_x');
	// t.trackPageView('myUrl', 'myPage', 'myReferrer', 'myCustomContexts');

	// t.trackStructEvent('shop', 'add-to-basket', null, 'pcs', 2);
	global.t.trackScreenView('name', 'id', ['context'], 500000);

	// e.flush();
}

render() {
return (




)
}
}

class Counter extends Component {
state = {
count: 0
};
handleClick = () => {
global.t.trackLinkClick(
http://www.findme.com’//, // URL
);
this.setState((prevState, { count }) => ({
count: prevState.count + 1
}));
};
render() {
return {this.state.count};
}
}

@Alexandre_Rayes, judging by the error message the event is not formed correctly. In fact, there are 2 distinct errors:

  • unexpected property headers
  • fundamental properties are missing - data, schema

Looking through Node.js tracker documentation I cannot see trackLinkClick method in there. You seem to have added it yourself which resulted in the incorrectly formed (unrecognized) event.

Hi @Alexandre_Rayes,

You’re importing the react native tracker, which as you will see by the Github page, is still under development and only supports one track method currently.

Your code, however, looks like it’s adapted from the Node.js tracker docs. The node tracker is still less developed than we’d like it to be but does support more track methods.

If you switch to using the node tracker, and instead of using unsupported methods like trackLinkClick use custom events (trackUnstructEvent()) I think you should be able to achieve what you’re aiming at here.

Best,

@ihor @Colm thank you, I didn’t know it was that obvious.
Consider this solved.