Hello Snowplow Community,
I have dockerized micro running locally on port 9090. I am able to send events from react-native and the micro recieves them. However, when I am running the kafka stream collector locally at 9090 and when I try to send an event from react-native tracker, I am getting this error in my console from expo react-native client:
error: TypeError: Network request failed
at D:\main\temp\app\node_modules\whatwg-fetch\dist\fetch.umd.js:535:18
at D:\main\temp\app\node_modules\react-native\Libraries\Core\Timers\JSTimers.js:214:18
at _callTimer (D:\main\temp\app\node_modules\react-native\Libraries\Core\Timers\JSTimers.js:112:7)
at Object.callTimers (D:\main\temp\app\node_modules\react-native\Libraries\Core\Timers\JSTimers.js:357:7)
at MessageQueue.__callFunction (D:\main\temp\app\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:423:27)
at D:\main\temp\app\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:113:12
at MessageQueue.__guard (D:\main\temp\app\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:367:9)
at MessageQueue.callFunctionReturnFlushedQueue (D:\main\temp\app\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:112:10)
at debuggerWorker.aca173c4.js:4:902
I have tried to change the CORS settings inside my stream-collector config but that didn’t help. I suspect that the cause is an unsuccessful TCP handshake.
The code that I am using to send out events from my react-native app:
const tracker = createTracker(
'myTracker',
{
endpoint: `http://192.168.213.68:9090`,
},
{
trackerConfig: {
appId: 'ReactNativeTracker',
},
},
);
tracker.trackSelfDescribingEvent({
schema: "iglu:com.company/raw_events_public/jsonschema/1-0-0",
data: trackerData
})
In the code, trackerData is just a JS object.
If anyone, has run into same problem or have any solutions, please let us know. Thank you for your time.
Here’s the configuration file for Kafka stream collector:
collector {
interface = "0.0.0.0"
port = 9090
p3p {
policyRef = "/w3c/p3p.xml"
CP = "NOI DSP COR NID PSA OUR IND COM NAV STA"
}
crossDomain {
enabled = false
domains = ["*"]
secure = false
}
cookie {
enabled = true
expiration = 365 days
name = gaCollectorCookie
domain = kijanowski.eu
}
doNotTrackCookie {
enabled = false
name = todoCookieName
value = todoCookieValue
}
cookieBounce {
enabled = false
name = "n3pc"
fallbackNetworkUserId = "00000000-0000-4000-A000-000000000000"
forwardedProtocolHeader = "X-Forwarded-Proto"
}
redirectMacro {
enabled = false
placeholder = "[TOKEN]"
}
rootResponse {
enabled = false
statusCode = 302
headers = {
Location = "https://127.0.0.1/",
X-Custom = "something"
}
body = "302, redirecting"
}
cors {
accessControlMaxAge = 5 seconds
}
prometheusMetrics {
enabled = true
durationBucketsInSeconds = [0.1, 3, 10]
}
streams {
good = ga-success
bad = ga-fail
useIpAddressAsPartitionKey = false
sink {
enabled = kafka
brokers = "0.0.0.0:9092"
retries = 0
producerConf {
acks = all
}
}
buffer {
byteLimit = 100000
recordLimit = 1 # Not supported by Kafka; will be ignored
timeLimit = 1 # -> Kafka's linger.ms
}
}
}
akka {
loglevel = DEBUG # 'OFF' for no logging, 'DEBUG' for all logging.
loggers = ["akka.event.slf4j.Slf4jLogger"]
http.server {
remote-address-header = on
raw-request-uri-header = on
parsing {
max-uri-length = 32768
uri-parsing-mode = relaxed
}
}
}