Skip to content

🐛 [storage-resize-images] Blocked images by Vertex AI are not moved to the failed path due to bypassed catch block #2762

@tomassator

Description

@tomassator

[REQUIRED] Step 2: Describe your configuration

  • Extension name: storage-resize-images
  • Extension version: 0.3.2
  • Configuration values (redact info where appropriate):
    • Cloud Storage path for failed images: failed
    • Content filter level: High strictness
    • Path to placeholder image: placeholder/blocked-content.png
    • Deletion of original file: Delete on any resize attempt (Bug happens with 'Keep' as well)
    • Convert image to preferred types: webp

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

  1. Install the storage-resize-images extension with Content Filtering enabled (Vertex AI API enabled).
  2. Configure a valid path for Cloud Storage path for failed images (e.g., failed).
  3. Configure a custom placeholder image.
  4. Upload an image that triggers the content filter (e.g., inappropriate content).
  5. Review the Storage bucket and the Cloud Function logs.
Expected result

According to the official documentation:

"If you’ve configured a failed images path, the original image is moved to that location with metadata indicating it was blocked by content filtering."

The expected behavior is that the extension generates the resized placeholder versions AND moves the original malicious image to the failed path, adding the rejection metadata.

Actual result

The extension successfully detects the inappropriate content and successfully generates the resized placeholder images (e.g., _200x200.webp, _600x600.webp). However, the original blocked image is NEVER moved to the failed images path, nor is any metadata applied to it.

Technical context (Why this is happening):
Looking at the Cloud Function logs, when Vertex AI blocks the content, the extension successfully swaps the image buffer with the placeholder buffer and completes the resizing process. Because this placeholder replacement is successful, the function finishes with status: 'ok'.

It appears the logic to move the original file to the failed path and apply rejection metadata is currently placed inside an error handling block (catch). Since the placeholder generation prevents the function from throwing an error, the catch block is completely bypassed, leaving the original blocked image in its source directory.

Log sequence observed:

  1. Replacing filtered image with configured placeholder...
  2. Image content blocked by Vertex AI content filters.
  3. Successfully replaced filtered image with placeholder...
  4. Resizing image at path...
  5. Function execution took X ms, finished with status: 'ok'
    (Missing: Any log indicating "Moving original file to failed path")

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions