Overview
This node interacts with the NATS JetStream Key-Value (KV) Store, allowing users to manage KV buckets and keys within those buckets. Specifically, for the Key - Get operation, it retrieves the value associated with a specified key from a given KV bucket.
Common scenarios where this node is beneficial include:
- Fetching configuration or user preference data stored in a distributed KV store.
- Retrieving cached data or session information managed via NATS JetStream.
- Accessing hierarchical key-value pairs organized by dot notation keys.
For example, you might use this node to get the current settings of a user profile stored under the key user.123.settings in the bucket user-preferences.
Properties
| Name | Meaning |
|---|---|
| Bucket Name | The name of the KV bucket to operate on. Must contain only letters, numbers, underscores, and hyphens (no spaces or dots). Example: user-preferences, app-config, cache-data. |
| Key | The key to retrieve from the bucket. Supports dot notation for hierarchical organization (e.g., user.123.settings). Cannot contain spaces. Examples: config.database.host, user.profile.avatar, session.abc123. |
Output
The node outputs an array of JSON objects corresponding to each input item processed. For the Get operation on a key, the output JSON contains the retrieved value(s) associated with the specified key from the KV bucket.
The exact structure depends on the underlying NATS JetStream KV API response but generally includes the key's value and metadata such as revision or creation time.
If the key does not exist or an error occurs, the node will either throw an error or return an error object depending on the "Continue On Fail" setting.
This node does not output binary data.
Dependencies
- Requires a connection to a NATS JetStream server with access to the KV store.
- Needs an API authentication credential configured in n8n to connect securely to the NATS server.
- Uses the bundled
nats-bundledlibrary and utility modules for connection management and operations.
Troubleshooting
- Invalid Bucket Name: Bucket names must only contain letters, numbers, underscores, and hyphens. Using invalid characters will cause validation errors.
- Unknown Operation or Resource: If an unsupported operation or resource is specified, the node throws an error indicating the unknown operation/resource.
- Connection Issues: Failure to connect to the NATS server due to incorrect credentials or network issues will result in connection errors.
- Key Not Found: Attempting to get a non-existent key may result in an error or empty response depending on the KV store behavior.
- Continue On Fail: If enabled, the node will continue processing subsequent items even if some fail, returning error details per item.
To resolve errors:
- Verify bucket and key names conform to allowed formats.
- Ensure correct and valid credentials are set up.
- Confirm the NATS JetStream server is reachable and the KV bucket exists.
- Check the node parameters for typos or unsupported values.