Failure | Tracker to Collector

Hello everyone,

I am using Scala Stream Collector, and it’s working fine.
When curl http://localhost:8081/health response is OK.

Now when I track event with this code.

        ;(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","https://cdn.jsdelivr.net/gh/blabla/optimonoJsTracker@main/sp.js","snowplow"));

        window.snowplow('newTracker', 'collector', 'localhost:8081', { // Initialise a tracker
          appId: 'showcase'
        });

    </script>
    <!-- Snowplow stops plowing -->

    <!-- Example events -->
    <script type="text/javascript">

        function viewProperty() {
            window.snowplow('trackStructEvent', 'viewProperty', 'CBL', '1234567890');
        }
    </script>
</head>

<body>
    <h1>Event Tracker Example</h1>

    <p>Press the button below to trigger individual tracking events:<br><br>
        <button type="button" onclick="viewProperty()">Track Event</button><br>
    </p>
</body>

It shows me this:


All help will appreciated, thanks :slight_smile:

This looks like the OPTIONS request to the collector is failing so you’re getting a CORS error (as different ports violates CORS). I believe that this suggests your collector isn’t set up correctly. Check your network requests in the browser and see what the OPTIONS request looks like.

1 Like

When I open Akka - Debug option, I can finally find the problem. (I guess)

[ERROR] [10/24/2020 22:05:48.854] [scala-stream-collector-akka.actor.default-dispatcher-4] [akka.actor.ActorSystemImpl(scala-stream-collector)] Error during processing of request: ‘Can’t convert value of class [B to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer’. Completing with 500 Internal Server Error response. To change default exception handling behavior, provide a custom ExceptionHandler.

org.apache.kafka.common.errors.SerializationException: Can’t convert value of class [B to class org.apache.kafka.common.serialization.StringSerializer specified in value.serializer

Caused by: java.lang.ClassCastException: class [B cannot be cast to class java.lang.String ([B and java.lang.String are in module java.base of loader ‘bootstrap’)

Also one more thing scala collector shows kafka version 2.2.0 but my kafka instance version is 2.6.0.


Any suggestion?