Cors Issue in SnowPlow

I have successfully setup scala-stream-collector in my local computer (ubuntu) where i have run it using stdout. Some of my collector configuration are:
collector.port=8383
collector.cookie.domains=[“localhost:8282”]//here i am trying to track page view for another project setup in that port (will it work for testing or not?)

Than I have setup Javascript Tracker for integrating snowplow javascript tracking tags directly onto website.

<script type="text/javascript">

;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];

p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)

};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;

n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","http://localhost:8282/js/sp.js","snowplow"));

window.snowplow('newTracker', 'cfZanui', 'localhost:8383', { // Initialise a tracker

appId: 'zanuihostjsappid',

cookieDomain: 'localhost:8282'

});

window.snowplow('trackPageView');

</script>

But i get the CORS error

Help me since i am new on this!

CORS errors will occur if the port doesn’t match, so you need to ensure your CORS headers specifically allow that url with the port. In particular the cross domain section of your collector configuration needs to be set up to allow this: https://github.com/snowplow/stream-collector/blob/master/examples/config.hocon.sample#L64

Ok i have managed solve it using CORS extension in chrome. Now i am getting 500 error.

where can i see the request logs of javascript tracker?

I would bet that this is because you’ve set a collector up locally, and the port in question needs to be exposed to receive web traffic.

In general the pipeline is built for a cloud environment, so these little issues might arise if you’re trying to use it in a local env.

Having never done it this way, I’m not exactly sure the steps to expose the port, but my gut says stack overflow could answer that question fairly easily. :slight_smile: