I’m trying to get a custom API Enrichment working ( Custom API Request enrichment | Snowplow Documentation ) for stream-enrich-kafka (docker image tag snowplow/stream-enrich-kafka:2.0.5) but am unable to get even the simplest example to work. My config is:
The http service I’m targeting is a simple express app that just repeats the input (auctionID) back out. It also logs whenever it is hit, and I’m not seeing any log messages
Things I have tried:
Confirming my config file has validated
Confirming that my jsonschema are reachable by the resolver
Confirming that my auction_init events are coming through (I have a tool which watches the kafka stream for the schema criteria I target)
Confirming that host.docker.internal:4001 is reachable by the enricher container
I can’t seem to get the enrichment to work. I assume that stream-enrich-kafka supports the feature since I get validation errors if the config is incorrect
@ShortRoundDev, the name of your enrichment configuration is not correct. It has to be “api_request_enrichment_config” but you changed it to “sample_api_enrichment_config”. As a result, the configuration cannot be validated against its own JSON schema, iglu-central/1-0-0 at master · snowplow/iglu-central · GitHub.
What makes Snowplow special is the ability to create data where everything is validated before the data can reach its destination. The enrichment configurations themselves need to be validated against the corresponding JSON schemas. To be able to validate, we use so-called “self-describing JSON” which tells the Iglu where to locate the JSON schema that has to be used for validation purposes. Since the name you used is not located on our Iglu Central, the configuration structure cannot be validated.
To answer your question directly, no, the name is predefined and is not custom unless you host the corresponding JSON schema in your own Iglu server (that is it could be located somewhere). The properties vendor and name are used to locate the JSON schema that describes the actual data - here, it is the configuration itself.
You can read more about “self-describing” JSON schema here.
I understand self-describing json schema; my misunderstanding was that I thought the $schema field itself was enough for snowplow to find the type of enrichment. Since the “self” field of other self-describing json schema has “name” and “vendor” fields meant for the name of the schema and the vendor creating it (e.g: the name of the company), it is confusing that in this case, “name” and “vendor” must always be that of the custom enrichment config and com.snowplowanalytics.snowplow.enrichments
and it would also be helpful if these fields were hardcoded to accept only those values during validation, using the “pattern” field of jsonschema e.g: