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

This node enables interaction with Cloudflare R2 object storage, specifically focusing here on deleting an object from a specified bucket. It allows users to remove files stored in their R2 buckets by specifying the bucket name and the object's key (its path or filename). This operation is useful for managing storage space, removing outdated or unwanted files, or automating cleanup tasks.

Practical examples include:

  • Automatically deleting log files older than a certain date.
  • Removing temporary files after processing.
  • Cleaning up user-uploaded content upon account deletion.

Properties

Name Meaning
Bucket Name The name of the R2 bucket where the object resides. Must be specified to target the correct bucket.
Object Key The key (path and filename) of the object within the bucket to delete. For example, folder/filename.ext.

Output

The output JSON contains:

  • success: A boolean indicating whether the deletion was successful.
  • message: A string confirming the deletion, e.g., "Object folder/filename.ext deleted".

No binary data is output for this operation.

Example output:

{
  "success": true,
  "message": "Object folder/filename.ext deleted"
}

Dependencies

  • Requires an API authentication credential configured in n8n to access Cloudflare R2.
  • Depends on internal utility functions for validating object keys and performing the delete operation via Cloudflare's API.

Troubleshooting

  • Invalid object key format: If the object key does not meet expected formatting rules, the node will throw an error. Ensure the key matches the path and filename conventions used in your bucket.
  • Bucket or object not found: If the specified bucket or object does not exist, the deletion will fail. Verify that the bucket name and object key are correct.
  • API authentication errors: Ensure the API credentials are valid and have sufficient permissions to delete objects.
  • Exceeding rate limits or network issues: May cause failures; retry or check network connectivity.

Links and References

Discussion