Actions9
Overview
This node integrates with Cloudflare R2, a scalable object storage service compatible with the S3 API. Specifically, the "Object Delete" operation allows users to delete an object stored in a specified R2 bucket by providing the bucket name and the object's key (path).
Common scenarios for this node include:
- Cleaning up or removing obsolete files from Cloudflare R2 buckets.
- Automating deletion of temporary or processed data objects.
- Managing storage costs by deleting unused objects.
Practical example:
- After processing a file downloaded from R2, you can use this node to delete the original object to free up space.
Properties
| Name | Meaning |
|---|---|
| Bucket Name | The name of the Cloudflare R2 bucket where the object resides. Must be provided. |
| Object Key | The key (path) identifying the specific object within the bucket to delete. |
Output
The node outputs JSON data indicating the success status of the deletion operation along with the bucket and object key involved. The output structure is:
{
"success": true,
"bucket": "example-bucket",
"key": "path/to/object"
}
No binary data is output by this operation.
Dependencies
- Requires valid Cloudflare API credentials configured with "R2 S3-Compatible" authentication mode.
- Needs the R2 Access Key ID, Secret Access Key, and Account ID.
- The node uses AWS SDK v3 S3 client internally to interact with R2 via its S3-compatible API endpoint.
- Network access to the Cloudflare R2 endpoint corresponding to the account and jurisdiction.
Troubleshooting
- Missing or invalid credentials: If the R2 Access Key ID, Secret Access Key, or endpoint are missing or incorrect, the node will throw an error indicating invalid R2 credentials. Ensure that the Cloudflare API credentials are correctly set and the authentication mode is "R2 S3-Compatible".
- Bucket not found: Deleting an object from a non-existent bucket will result in an error. Verify the bucket name is correct and exists.
- Object not found: Attempting to delete a non-existent object may return a success response or an error depending on R2 behavior; verify the object key.
- Network issues: Connectivity problems to the R2 endpoint will cause request failures. Check network settings and firewall rules.
- Permission errors: Insufficient permissions in the API token or keys will cause authorization errors. Confirm the token has delete permissions on the bucket.
Links and References
- Cloudflare R2 Documentation
- Cloudflare API Tokens
- AWS SDK for JavaScript v3 - S3 Client
- n8n Custom Node Development
Summary of execute() logic for Resource=Object, Operation=Delete
- Retrieves input items.
- For each item:
- Extracts
bucketNameandobjectKeyparameters. - Obtains Cloudflare R2 credentials (access key, secret key, endpoint).
- Validates credentials presence.
- Constructs a signed HTTP DELETE request to the URL:
{endpoint}/{bucketName}/{objectKey}using AWS Signature V4. - Sends the request to delete the object.
- On success, pushes a JSON object with
success: true,bucket, andkey. - On failure, throws or returns an error depending on the node's error handling configuration.
- Extracts
This operation directly deletes the specified object from the given R2 bucket using the S3-compatible API.