NATS Object Store icon

NATS Object Store

Store and retrieve objects (files, data) in NATS JetStream Object Store - manage buckets and objects

Overview

This node integrates with NATS JetStream Object Store, allowing users to manage buckets and objects within those buckets. Specifically, the Bucket - Create operation enables creating a new object store bucket with customizable configuration options such as description, TTL (time-to-live), maximum size, storage backend type, and replication factor.

Common scenarios for this node include:

  • Setting up isolated storage containers (buckets) for different projects or data types.
  • Configuring buckets with specific retention policies (TTL) to automatically delete old objects.
  • Choosing storage backends optimized for performance or persistence needs.
  • Managing fault tolerance by specifying the number of replicas.

Practical example: A user wants to create a bucket named "my-files" on NATS JetStream to store uploaded documents with automatic cleanup after 30 days and a maximum size limit of 10 GB, stored on disk with 3 replicas for reliability.

Properties

Name Meaning
Bucket Name Name of the Object Store bucket. Must contain only alphanumeric characters, dashes, and underscores.
Config Collection of optional configuration settings for the bucket:
  Description Text description of the bucket (e.g., "File storage bucket").
  TTL (Seconds) Time-to-live for objects in seconds. Objects older than this are automatically deleted. 0 means unlimited.
  Max Bucket Size (Bytes) Maximum total size of the bucket in bytes. -1 means unlimited.
  Storage Type Storage backend for the bucket. Options: "File" (store on disk), "Memory" (store in memory).
  Replicas Number of replicas for the bucket to provide fault tolerance. Higher numbers increase redundancy.

Output

The node outputs an array of JSON objects representing the result of the bucket creation operation. Each output item corresponds to one input item processed.

  • The json field contains the response from the bucket creation handler, typically including details about the created bucket such as its name, configuration, and status.
  • If an error occurs during processing, the output includes an error object describing the issue along with the relevant input parameters.

No binary data is output by this operation.

Dependencies

  • Requires a valid connection to a NATS JetStream server with appropriate permissions to manage object store buckets.
  • Needs an API authentication credential configured in n8n to establish the NATS connection.
  • Uses internal utility modules for connection management, logging, and validation.

Troubleshooting

  • Invalid bucket name error: Bucket names must only contain alphanumeric characters, dashes, and underscores. Ensure the bucket name follows these rules.
  • Unknown bucket operation: If an unsupported operation is specified, the node will throw an error. Verify that the operation is set to "create" for this use case.
  • Connection errors: Failure to connect to the NATS server may occur due to incorrect credentials or network issues. Check the API key and server availability.
  • Quota exceeded: Setting a max bucket size too low or conflicting TTL values might cause unexpected behavior. Adjust configuration accordingly.
  • Use the "Continue On Fail" option to handle errors gracefully and process multiple items without stopping on the first failure.

Links and References

Discussion