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 dedicated storage buckets for different types of files or data streams.
  • Creating buckets with specific lifecycle policies (e.g., automatic deletion after a certain time).
  • Configuring buckets for fault tolerance by specifying replicas.
  • Choosing between in-memory or file-based storage depending on performance or persistence needs.

Practical example: A user wants to create a bucket named "my-files" that stores files on disk, has a maximum size limit, and automatically deletes objects older than 7 days. This node allows configuring all these parameters during bucket creation.

Properties

Name Meaning
Bucket Name The name of the Object Store bucket to create. Bucket names can only contain 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 value will be 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 JSON data representing the result of the bucket creation operation. This typically includes details about the newly created bucket such as its name and configuration status.

No binary data output is produced 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 connect securely to the NATS server.
  • The node uses internal utilities to validate bucket names and handle connection lifecycle.

Troubleshooting

  • Invalid bucket name error: Bucket names must only contain alphanumeric characters, dashes, and underscores. Ensure the bucket name follows this rule.
  • 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 if credentials are incorrect or the server is unreachable. Check network connectivity and credential validity.
  • Quota exceeded: If the max bucket size is set too low or the server enforces limits, bucket creation might fail. Adjust size limits accordingly.
  • Permission denied: Insufficient permissions on the NATS server to create buckets will cause errors. Confirm that the API key has required privileges.

If the node is set to continue on failure, errors for individual items will be returned in the output with detailed messages.

Links and References

Discussion