Skip to content

Conversation

dlarocque
Copy link
Contributor

If the responseJson from the Predict request has an image, the entire image base64 will be included in the error message. This can make the error message >400kB (!!), which could cause a variety of issues in client apps.

I ran into this when testing #9216. The new safetyAttributes field being included in the predictions array in responses caused this error to be raised. But, since the predictions array also had images, the error message would be massive and caused serious performance issues when rendered in the sample app.

If the `responseJson` from the Predict request has an image, the entire
image base64 will be included in the error message. This can make the error
message >400kB (!!), which could cause performance issues in apps.

I ran into this when testing #9216,
since the `safetyAttributes` would be included in a response and trigger
this error, but the `predictions` array in `responseJson` would have images.
I noticed that when the sample app rendered the `error.message`, it
began running into serious performance issues.
@dlarocque dlarocque requested a review from hsubox76 August 21, 2025 14:37
@dlarocque dlarocque requested review from a team as code owners August 21, 2025 14:37
Copy link

changeset-bot bot commented Aug 21, 2025

🦋 Changeset detected

Latest commit: 7ea2554

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@firebase/ai Patch
firebase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • @firebase/ai

    TypeBase (9b63cd6)Merge (9b029aa)Diff
    browser45.9 kB45.9 kB-9 B (-0.0%)
    main49.0 kB49.0 kB-9 B (-0.0%)
    module45.9 kB45.9 kB-9 B (-0.0%)
  • firebase

    TypeBase (9b63cd6)Merge (9b029aa)Diff
    firebase-ai.js35.7 kB35.7 kB-7 B (-0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/SkIaqfGYpx.html

@google-oss-bot
Copy link
Contributor

Size Analysis Report 1

Affected Products

  • @firebase/ai

    • ImagenModel

      Size

      TypeBase (9b63cd6)Merge (9b029aa)Diff
      size9.19 kB9.18 kB-7 B (-0.1%)
      size-with-ext-deps26.8 kB26.8 kB-7 B (-0.0%)
    • getImagenModel

      Size

      TypeBase (9b63cd6)Merge (9b029aa)Diff
      size9.35 kB9.34 kB-7 B (-0.1%)
      size-with-ext-deps27.0 kB27.0 kB-7 B (-0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/2RxZ7OGuHI.html

@dlarocque dlarocque merged commit 84b8bed into main Aug 21, 2025
37 of 38 checks passed
@dlarocque dlarocque deleted the dl/imagen-predictions-error branch August 21, 2025 17:14
@google-oss-bot google-oss-bot mentioned this pull request Aug 27, 2025
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.

3 participants