Skip to content

GCP Pub/Sub Triggers

Orvanta can connect to Google Cloud Pub/Sub and trigger a script or flow in response to messages published on a topic, either by pulling from a subscription or by receiving pushed messages on an auto-generated endpoint.

GCP Pub/Sub triggers are an Enterprise-tier feature (gcp_pubsub_trigger in the edition matrix) and are compiled into the single Orvanta enterprise build. Creating or updating one on a lower licence tier is refused.

A GCP-triggered preprocessor receives an event shaped like this (the shape is built from the trigger’s job arguments in the platform code):

export async function preprocessor(
event: {
kind: 'gcp',
data: string, // base64 encoded payload
attributes: Record<string, string>,
message_id: string,
publish_time: number | null, // epoch milliseconds
subscription: string,
delivery_attempt?: number | null // pull delivery only
}
) {
if (event.kind !== 'gcp') {
throw new Error(`Expected a GCP trigger kind, got: ${event.kind}`);
}
const decodedString = atob(event.data);
return {
messageAsDecodedString: decodedString,
attributes: event.attributes ?? {},
};
}
  • data: The Pub/Sub message, base64-encoded.
  • message_id: Unique message ID assigned by Pub/Sub.
  • subscription: The subscription that delivered the message.
  • publish_time: When the message was published, in epoch milliseconds.
  • attributes: User-defined key-value metadata attached to the message.
  • delivery_attempt: Present for pull delivery; it climbs past 1 on redelivery. Push deliveries do not carry it.

The event does not include a delivery_type, headers or ordering_key field.

See Preprocessors for how a preprocessor’s return value maps onto a script’s main() parameters.