Skip to content

Conversation

cnaples79
Copy link

The storage-resize-images function could run twice for a single upload if the resized outputs re-triggered the function. This happens when resizedImage custom metadata is stored as a boolean true while the filter only checked for the string "true".

Changes

  • filters: treat metadata.resizedImage === true or "true" as already-resized to short‑circuit early.
  • upload: set resizedImage metadata to string "true" for consistency with existing expectations.
  • tests: add coverage for the boolean variant in metadata checks.

Why

  • Cloud Storage custom metadata can arrive as a boolean or a string; handling both ensures idempotence and prevents reprocessing outputs.

Fixes #932.

…edImage flag as string or boolean\n\n- filters: treat metadata.resizedImage === true or "true" as already-resized\n- upload: set resizedImage metadata to string "true" for consistency\n- tests: cover boolean variant in metadata checks\n\nFixes firebase#932
@cabljac
Copy link
Contributor

cabljac commented Sep 18, 2025

Hi, thanks for opening this issue! I'm not sure it will fix #932 though, as the function will still be invoked? The filtering happens after the invocation within the runtime of the function. Making this more robust is still worthwhile though, we'll review this and hopefully get it out ASAP

@cabljac cabljac requested a review from CorieW September 18, 2025 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[storage-resize-images] The resize function is called twice for each uploaded image
2 participants