We have been trying to extract a cookie value. Our cookies are URL encoded JSON serialized objects. Ideally we would extract our cookie from raw event headers, then URL decode it to yield a JSON serialized object. We would then convert this object to a derived context and attach it to the original event.
Unfortunately, JS configurable enrichment receives EnrichedEvent, not raw. So we opted into setting up a cookie extractor enrichment and a follow-up JS enrichment to look for derived contexts where cookie extractor was expected to store its results. To our dismay, event.getDerived_contexts() returns null all the time.
We are in fact using a Scala collector and do see cookie extractor output in the enriched data, we just can’t quite get to it from inside the JS enricher’s process(event) function. Can we affect the registry in any way to ensure that JS enricher runs after the Cookie extractor enricher? Are these processes running in parallel or sequentially? Would it make sense to have JS enricher to implement both process_enriched(EnrichedEvent event) and process_raw(SnowplowRawEvent event) or have a lifecycle to be able to attach to?
Any suggestions would be very appreciated!