Actions9
- Namespace Actions
- Key-Value Actions
Overview
This node integrates with Cloudflare Workers KV, a globally distributed key-value storage system. It allows users to perform various operations on namespaces and key-value pairs within those namespaces. Specifically, the "Get" operation under the "Key-Value" resource retrieves the value associated with a specified key from a given namespace.
Common scenarios for this node include:
- Retrieving configuration or state data stored in Cloudflare KV.
- Accessing cached content or user session data.
- Fetching feature flags or other dynamic values managed via KV storage.
For example, you might use this node to get a user's preferences stored under a specific key or retrieve API tokens saved in a KV namespace.
Properties
| Name | Meaning |
|---|---|
| Namespace ID | The ID of the KV namespace where the key resides. |
| Key | The key whose value you want to retrieve from the specified namespace. |
Output
The output JSON object for the "Get" operation includes:
key: The requested key.value: The value stored for that key. If the key does not exist, this will benull.metadata(optional): Any arbitrary JSON metadata associated with the key-value pair, if present.error(optional): If the key is not found, an error message"Key not found"is included.
Example output when key exists:
{
"key": "exampleKey",
"value": "exampleValue",
"metadata": {
"createdBy": "user123"
}
}
Example output when key does not exist:
{
"key": "missingKey",
"value": null,
"error": "Key not found"
}
The node does not output binary data for this operation.
Dependencies
- Requires a valid Cloudflare account with access to Workers KV.
- Needs an API authentication token credential configured in n8n to authorize requests.
- The node makes HTTP requests to the Cloudflare API endpoint for KV namespaces and values.
Troubleshooting
- Key Not Found: If the key does not exist in the namespace, the node returns a JSON with
valueasnulland an error message"Key not found". This is expected behavior and not an execution error. - Authentication Errors: If the API token or account ID credentials are invalid or missing, the node will throw an authorization error. Ensure the API token has appropriate permissions for KV operations.
- Namespace ID Issues: Providing an incorrect or non-existent namespace ID will result in errors. Verify the namespace ID is correct and accessible.
- Rate Limits or API Errors: Cloudflare may enforce rate limits or return errors for malformed requests. Check the error messages returned by the node for details and adjust usage accordingly.
- Continue On Fail: If enabled, the node will continue processing subsequent items even if one fails, returning error details in the output JSON.