Transformations in cloud mode

Use transformations with cloud mode destinations.

When you add a transformation and connect it to a cloud mode-supported destination, RudderStack does the following:

  1. Tracks and collects events at the source.
  2. Applies the transformation logic to your events.
  3. Forwards the transformed event to your connected destination.
Transformations workflow

Applying transformation on a batch of events

You can perform any aggregation or roll-up operation on a batch of events using the transformBatch function instead of transformEvent:

danger

To ensure event ordering when using the transformBatch function, make sure you pass the messageId from the input event to the output event. Without the messageId, RudderStack does not guarantee event ordering.

It is highly recommended to use transformEvent as much as possible, as it ensures event ordering.

Debugging transformations

Once you add a transformation, you can capture any event-related information in the form of logs while running a test on your transformation. You can do this by including the log function in your transformation code.

An example of using the log function is shown below:

On adding the above transformation and clicking Run Test, you can see the resulting log in the Logs section of the dashboard:

Transformation log
info
You can pass a string, number, or an object as an argument to the log function.

Limitations

The transformation fails if the following memory and time limits are exceeded:

ParameterLimit
Memory limit128 MB
Execution time limit4 seconds

Questions? Contact us by email or on Slack