Google Cloud Storage Enhanced icon

Google Cloud Storage Enhanced

Use the Google Cloud Storage API

Overview

This node allows you to update an object (file) in a Google Cloud Storage bucket. It is designed for scenarios where you need to modify metadata, access controls, or other properties of an existing object without re-uploading its content. Common use cases include updating custom metadata, changing access permissions, or setting retention and encryption options on stored files.

Practical examples:

  • Updating the metadata of a file after processing.
  • Changing the access control list (ACL) to make a file public or restrict access.
  • Setting or modifying cache control headers for CDN optimization.
  • Applying or removing temporary holds for compliance purposes.

Properties

Name Type Meaning
Authentication options Selects the authentication method: Service Account or OAuth2.
Bucket Name string The name of the Google Cloud Storage bucket containing the object to update.
Object Name string The name (key) of the object (file) to update within the specified bucket.
Projection options Determines which set of properties to return in the response: "All Properties" or "No ACL".
Update Fields collection Fields to update on the object, such as ACL, cache control, content type, metadata, and hold flags.
Additional Parameters collection Advanced query parameters for conditional updates, versioning, and predefined ACLs.
Encryption Headers collection Optional headers for customer-supplied encryption keys (e.g., algorithm, key, key hash).

Details for "Update Fields" collection:

  • Access Control: JSON array specifying new ACL entries.
  • Cache Control: String for cache control header.
  • Content Disposition: String for content disposition header.
  • Content Encoding: String for content encoding header.
  • Content Language: String for content language header.
  • Content Type: MIME type of the object.
  • Custom Time: Custom timestamp.
  • Event Based Hold: Boolean to enable/disable event-based hold.
  • Metadata: JSON object with custom metadata.
  • Temporary Hold: Boolean to enable/disable temporary hold.

Details for "Additional Parameters" collection:

  • Generation: Number specifying a specific revision of the object.
  • Generation Match/Exclude: Numbers for conditional operations based on object generation.
  • Metageneration Match/Exclude: Numbers for conditional operations based on metageneration.
  • Predefined ACL: Predefined access control settings (e.g., publicRead, private).

Details for "Encryption Headers" collection:

  • Encryption Algorithm: Must be AES256 if using customer-supplied keys.
  • Encryption Key: Base64-encoded AES256 key.
  • Encryption Key Hash: Base64-encoded SHA256 hash of the key.

Output

The node outputs a JSON object representing the updated object’s metadata as returned by the Google Cloud Storage API. This typically includes fields such as:

{
  "kind": "storage#object",
  "id": "...",
  "selfLink": "...",
  "name": "...",
  "bucket": "...",
  "generation": "...",
  "metageneration": "...",
  "contentType": "...",
  "timeCreated": "...",
  "updated": "...",
  "storageClass": "...",
  "size": "...",
  "md5Hash": "...",
  "mediaLink": "...",
  "metadata": { ... },
  ...
}
  • If an error occurs and "Continue On Fail" is enabled, the output will contain an error field with the error message.

Dependencies

  • Google Cloud Storage API: Requires access to a Google Cloud project with the Storage API enabled.
  • Authentication: Either a Google Service Account credential or OAuth2 credentials must be 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 configured in n8n.
  • Insufficient permissions: The service account or OAuth2 user must have permission to update objects in the target bucket.
  • Object not found: Double-check the bucket and object names.
  • Conditional update failed: If using generation/metageneration match/exclude, ensure the values are correct and up-to-date.
  • Encryption errors: If supplying encryption headers, ensure the key and hash are correctly base64-encoded and match the object.

Error Messages:

  • "error": "Request had insufficient authentication scopes."
    Resolution: Check your credentials and ensure the required scopes are enabled.
  • "error": "No such object: ..."
    Resolution: Verify the bucket and object names.
  • "error": "Precondition Failed"
    Resolution: Review any conditional parameters (generation/metageneration) for accuracy.

Links and References

Discussion