Mobile Context Schema Error in Enricher

Hey,

I use android and ios trackers to send custom events to the snowplow pipeline setup on GCP. While tracking events I noticed the following error in my enricher bad records pubsub. Could someone help me in fixing this?

Error:

Tracker version: 3.0.3

Thank you!

Hi @siv can you share a bit more of the message if possible please? In particular the payload details for the appAvailableMemory field as that seems to be what’s causing the issue.

Hi @Ryan

I’ve pasted some parts of the event below for your reference.

{"schema":"iglu:com.snowplowanalytics.snowplow.badrows/schema_violations/jsonschema/2-0-0","data":{"processor":{"artifact":"snowplow-enrich-pubsub","version":"2.0.5"},"failure":{"timestamp":"2023-04-17T16:23:42.345410653Z","messages":[{"schemaKey":"iglu:com.snowplowanalytics.snowplow/mobile_context/jsonschema/1-0-2","error":{"error":"ValidationError","dataReports":[{"message":"$.appAvailableMemory: must have a maximum value of 4294967295","path":"$.appAvailableMemory","keyword":"maximum","targets":["4294967295"]}]}}]},"payload":{"enriched":{.........................,{\"schema\":\"iglu:com.snowplowanalytics.snowplow/mobile_context/jsonschema/1-0-2\",\"data\":{\"physicalMemory\":5972033536,\"appleIdfv\":\".......A1\",\"batteryLevel\":99,\"batteryState\":\"unplugged\",\"osVersion\":\"16.1.2\",\"appAvailableMemory\":2251799619450368,\"networkType\":\"wifi\",\"osType\":\"ios\",\"deviceModel\":\"iPhone14,7\",\"totalStorage\":127854202880,\"lowPowerMode\":false,\"deviceManufacturer\":\"Apple Inc.\",\"availableStorage\":80913743872}},..........

Hi siv - what schema or Iglu Repository do you happen to be using? The schema available in Iglu Central has a higher limit (9223372036854775807) for appAvailableMemory for the 1-0-2 schema.

http://iglucentral.com/schemas/com.snowplowanalytics.snowplow/mobile_context/jsonschema/1-0-2

Hi @mike

The schema I have in the Iglu Central is as follows:

{
	"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
	"description": "Schema for mobile contexts",
	"self": {
		"vendor": "com.snowplowanalytics.snowplow",
		"name": "mobile_context",
		"format": "jsonschema",
		"version": "1-0-2"
	},
	"type": "object",
	"properties": {
		"osType": {
			"type": "string"
		},
		"osVersion": {
			"type": "string"
		},
		"deviceManufacturer": {
			"type": "string"
		},
		"deviceModel": {
			"type": "string"
		},
		"carrier": {
			"type": ["string", "null"]
		},
		"networkType": {
			"type": ["string", "null"],
			"enum": ["mobile", "wifi", "offline", null]
		},
		"networkTechnology": {
			"type": ["string", "null"]
		},
		"openIdfa": {
			"type": ["string", "null"]
		},
		"appleIdfa": {
			"type": ["string", "null"]
		},
		"appleIdfv": {
			"type": ["string", "null"]
		},
		"androidIdfa": {
			"type": ["string", "null"]
		},
		"physicalMemory": {
			"type": ["integer", "null"],
			"minimum": 0,
			"maximum": 9223372036854775807,
			"description": "Total physical system memory in bytes"
		},
		"systemAvailableMemory": {
			"type": ["integer", "null"],
			"minimum": 0,
			"maximum": 9223372036854775807,
			"description": "Available memory on the system in bytes (Android only)"
		},
		"appAvailableMemory": {
			"type": ["integer", "null"],
			"minimum": 0,
			"maximum": 4294967295,
			"description": "Amount of memory in bytes available to the current app (iOS only)"
		},
		"batteryLevel": {
			"type": ["integer", "null"],
			"minimum": 0,
			"maximum": 100,
			"description": "Remaining battery level as an integer percentage of total battery capacity"
		},
		"batteryState": {
			"type": ["string", "null"],
			"enum": ["unplugged", "charging", "full", null],
			"maxLength": 255,
			"description": "Battery state for the device"
		},
		"lowPowerMode": {
			"type": ["boolean", "null"],
			"description": "A Boolean indicating whether Low Power Mode is enabled (iOS only)"
		},
		"availableStorage": {
			"type": ["integer", "null"],
			"minimum": 0,
			"maximum": 9223372036854775807,
			"description": "Bytes of storage remaining"
		},
		"totalStorage": {
			"type": ["integer", "null"],
			"minimum": 0,
			"maximum": 9223372036854775807,
			"description": "Total size of storage in bytes"
		}
	},
	"required": ["osType", "osVersion", "deviceManufacturer", "deviceModel"],
	"additionalProperties": false
}

I probably have to update the schemas then. Will take a latest pull.

Thank you!

No worries - how are you pulling these schemas in your pipeline out of interest? Did you one off clone the Iglu Central repository at some point in time or do you have some kind of mirror?

I did a one off clone into a GCS bucket and have been using it as a repository.