Custom JavaScript Enrichment hosted in S3

I am developing a custom JavaScript enrichment to add and modify event attributes. To attach this script, is it possible to upload the script to an S3 bucket and reference the enrichment JSON in DynamoDB?

I was wondering is it possible to that:

{
  "schema": "iglu:com.snowplowanalytics.snowplow.enrichments/javascript_script_enrichment/jsonschema/1-0-0",
  "data": {
    "enabled": true,
    "parameters": {
      "scriptUri": "s3://my-snowplow-bucket/enrichments/custom-enrichment.js"
    }
  }
}

Not currently, no. The script needs to be specified inline and can’t be fetched from a remote URI.

1 Like

Also one more doubt - I want to confirm whether JavaScript custom enrichments can directly add new fields at the root level of the event or if they must always be returned as a derived entity inside derived_contexts.

Currently, I am returning an entity like this:

return [
    {
        schema: "iglu:com.proemsportsanalytics/new_column/jsonschema/1-0-0",
        data: {
            new_column: new_column_value
        }
    }
];

I want new_column to be at root level, just like event_id, app_id, platform, etc. Will the above code return it as root level or as derived entity?

It’ll be as a derived entity - this is in keeping with the idea that enrichments that add data at enrichment time are inserted as contexts. Although you can modify properties at the root you cannot set them - as this would break the format of the event itself.

1 Like