Overview
This node allows you to delete an object (file) from a specified bucket in Google Cloud Storage. It is useful for automating the removal of files, such as cleaning up outdated backups, removing temporary data, or managing storage costs by deleting unnecessary objects.
Practical examples:
- Automatically delete log files older than a certain date.
- Remove user-uploaded files after account deletion.
- Clean up temporary exports after processing.
Properties
| Name | Type | Meaning |
|---|---|---|
| Authentication | options | Selects the authentication method: Service Account or OAuth2. |
| Bucket Name | string | The name of the bucket containing the object to be deleted. |
| Object Name | string | The name of the object (file) to delete within the specified bucket. |
| Additional Parameters | collection | Optional parameters to control conditional deletion and versioning. See below for details. |
Additional Parameters (collection):
| Name | Type | Meaning |
|---|---|---|
| Generation | number | Specifies a particular revision of the object to delete. |
| Generation Match | number | Deletes only if the object's generation matches this value. |
| Generation Exclude | number | Deletes only if the object's generation does NOT match this value. |
| Metageneration Match | number | Deletes only if the object's metageneration matches this value. |
| Metageneration Exclude | number | Deletes only if the object's metageneration does NOT match this value. |
Output
The output will be a JSON object indicating the result of the deletion operation. If successful, the response is typically empty ({}), as per Google Cloud Storage API's behavior for successful deletions.
If an error occurs and "Continue On Fail" is enabled, the output will include an error field with the error message:
{
"error": "Error message here"
}
Dependencies
- Google Cloud Storage API: Requires access to Google Cloud Storage.
- Authentication: Needs either a Service Account credential or OAuth2 credentials configured in n8n.
- n8n Credentials:
googleApi(for Service Account)googleCloudStorageOAuth2Api(for OAuth2)
Troubleshooting
Common Issues:
- Invalid credentials: Ensure that the selected authentication method is properly set up in n8n.
- Insufficient permissions: The service account or OAuth2 user must have permission to delete objects in the specified bucket.
- Object not found: If the object name or bucket name is incorrect, the API will return a "Not Found" error.
- Conditional parameters mismatch: If you use generation/metageneration conditions and they do not match the current object state, the deletion will fail.
Common Error Messages:
"No such object": The specified object does not exist in the bucket."Permission denied": The credentials used do not have sufficient permissions."Precondition failed": One of the conditional parameters (generation/metageneration) did not match.
How to resolve:
- Double-check bucket and object names.
- Verify credentials and permissions.
- Review any additional parameters for correctness.