Go JSONata fallback panic on CXone Data Action schema drift

Problem

Local docker compose harness keeps dropping the CXone Data Action events when the schema drifts. We’ve got the Go consumer subscribed to the Kafka mirror topic, but the JSONata rules just choke on missing fields. It’s supposed to fall back to the default mapping template before pushing to AWS SNS.

Code

if err := jsonata.Transform(raw, rules); err != nil {
 normalized, _ := jsonata.Transform(raw, fallbackTemplate)
 sns.Publish(normalized)
}

Error

panic: runtime error: invalid memory address or nil pointer dereference

Question

Trying to wrap the fallback logic in a defer block to keep the SNS delivery confirmation intact. Pointer keeps blowing up during the transform switch.

Schema drift always breaks the callback queue. Don’t patch the JSONata rules. Flip the retry logic to catch the drift before it hits the mapping template. Wrap the field lookup in a conditional check. The flow builder workaround is ugly but it stops the fallback panic. Keeps the wait time estimates from drifting too.