NATS Object Store Trigger
Watch for object changes in NATS Object Store buckets and trigger workflows
Overview
This node is a trigger that watches for changes in buckets within a NATS Object Store. It listens for object events such as creations, updates, and optionally deletions inside a specified bucket. When such changes occur, it triggers workflows in n8n, passing the details of the changed objects.
Common scenarios where this node is beneficial include:
- Automating processing or indexing of files as soon as they are uploaded or modified in an object store bucket.
- Keeping external systems synchronized with the latest state of objects in a bucket.
- Triggering notifications or audits when objects are deleted or updated.
- Initial migration or bulk processing by optionally including all existing objects on startup.
Practical example:
- A workflow that automatically generates thumbnails whenever new images are added to a bucket.
- Syncing metadata changes from the object store to a database in real-time.
- Archiving or backing up objects immediately after upload.
Properties
| Name | Meaning |
|---|---|
| Bucket Name | The name of the bucket to monitor for changes. Must contain only letters, numbers, hyphens, and underscores (no spaces or dots). |
| Options | Collection of additional options: |
| Include Deletes | Whether to trigger the workflow when objects are deleted from the bucket (true/false). Default is true. |
| Include History | Whether to process all existing objects in the bucket when the trigger starts. Useful for initial data processing or migration (true/false). Default is false. |
Output
The node outputs JSON data representing the object events detected in the bucket. Each emitted item contains fields such as:
name: The object's key or path within the bucket.size: Size of the object in bytes.chunks: Number of chunks the object is divided into.digest: Checksum or hash of the object content.mtime: Last modification time of the object (ISO string).bucket: The bucket name.deleted: Boolean indicating if the object was deleted.metadata: An object containing user-defined metadata associated with the object.revision: Revision number of the object.created: Creation timestamp (present in sample data)._sampleDataNote: Indicates if the data is sample data (used when no real objects are found).
If the node cannot fetch real data during manual triggering, it emits sample data mimicking typical object properties.
The node does not output binary data directly; it only provides metadata about objects.
Dependencies
- Requires connection to a NATS server with access to the JetStream Object Store feature.
- Needs an API authentication credential configured in n8n to connect securely to the NATS server.
- Uses internal utilities for managing NATS connections and logging.
Troubleshooting
- Connection issues: If the node logs errors about connection loss or permission errors, verify the NATS server URL, credentials, and network accessibility.
- Bucket name validation: Ensure the bucket name contains only allowed characters (letters, numbers, hyphens, underscores) without spaces or dots.
- No data received: If no objects are found and the node emits sample data, confirm that the bucket actually contains objects and that permissions allow listing them.
- Permission errors: Errors related to async permission issues may indicate insufficient rights on the NATS Object Store or JetStream configuration.
- Watcher loop stops: Warnings about the watcher loop stopping suggest unexpected disconnections; check server stability and network reliability.