Cloudflare R2 icon

Cloudflare R2

Interact with Cloudflare R2 object storage. Upload, download, manage files and buckets. Supports batch operations, multipart uploads, and can be used as a tool by AI Agents.

Overview

The Cloudflare R2 node allows users to interact with Cloudflare's R2 object storage service. Specifically, the "Object Upload" operation enables uploading files or text content into a specified R2 bucket. This is useful for automating file storage workflows such as backing up data, storing generated reports, or saving user-uploaded content in cloud storage.

Typical scenarios include:

  • Uploading binary files processed by previous nodes (e.g., images, PDFs).
  • Uploading dynamically generated text content (e.g., JSON, logs).
  • Attaching custom metadata to objects for easier categorization or retrieval.

For example, you could use this node to upload an image file received from a webhook or to save a JSON report generated within your workflow directly into an R2 bucket.

Properties

Name Meaning
Bucket Name The name of the R2 bucket where the object will be uploaded.
Object Key The key (path and filename) under which the object will be stored in the bucket.
Data Source Selects the source of the data to upload: either binary data from a previous node or direct text content. Options: Binary Data, Text Content.
Binary Property (Shown if Data Source is Binary Data) The name of the binary property containing the file data. Default is data.
Text Content (Shown if Data Source is Text Content) The raw text content to upload directly.
Content Type MIME type of the content being uploaded (e.g., image/jpeg, application/json). If left empty, the node attempts to auto-detect it.
Metadata Custom metadata fields to attach to the object. Users can specify multiple key-value pairs.

Output

The node outputs a JSON object with the following structure:

  • success: Boolean indicating if the upload was successful.
  • object: Metadata about the uploaded object returned from Cloudflare R2 (such as keys, timestamps, etc.).
  • message: A human-readable message confirming the upload status.

No binary output is produced by this operation since it uploads data rather than returning it.

Example output JSON:

{
  "success": true,
  "object": {
    // Metadata fields returned by Cloudflare R2 about the uploaded object
  },
  "message": "Object folder/filename.ext uploaded successfully"
}

Dependencies

  • Requires an API authentication credential for Cloudflare R2 configured in n8n.
  • Relies on Cloudflare R2 service availability.
  • No additional external dependencies beyond the configured credential and network access to Cloudflare R2.

Troubleshooting

  • Invalid bucket name format: The node validates bucket names before attempting upload. Ensure the bucket name follows Cloudflare R2 naming rules.
  • Invalid object key format: Object keys must be valid paths/filenames. Avoid invalid characters or empty keys.
  • Missing binary data: When using binary data as the source, ensure the specified binary property exists and contains valid data.
  • Content type detection: If the content type is not specified and cannot be auto-detected, the upload might default to text/plain or application/octet-stream, which may affect how the object is handled downstream.
  • API errors: Network issues or incorrect credentials will cause upload failures. Verify API keys and network connectivity.
  • Metadata format: Metadata keys and values must be strings; improper formatting may cause errors.

Links and References

Discussion