Skip to content

[JS] Image URLs via {{media url=image}} fail after update — is this intended? #4196

@7hokerz

Description

@7hokerz

Describe the bug
After updating to the latest version(Genkit JS 1.27.0),
image inputs defined via dotPrompt using {{media url=image}} cause a runtime error when converted to OpenAI chat completion content.
This feature works fine in version 1.26.0 or lower.

The probable causes are the following changes: https://github.com/firebase/genkit/pull/3923/files

Full error message:

Error: File URLs are not supported for chat completions.
Only base64-encoded files and image URLs are supported.
Content type: undefined

To Reproduce

  1. Define a prompt using dotPrompt with image media:
{{media url=image}}
  1. Bind image to a remote image Signed-URL from Firebase Storage:
{
  image: {
    url: 'https://storage.googleapis.com/...'
  }
}

Runtime (please complete the following information):

  • OS: windows 10 22H2

Node version

  • v24.13.0

Additional context
It looks like the regression is caused by relying solely on part.media.contentType
to determine whether a media input is an image.
One possible way to resolve this could be to prioritize the declared media intent
(e.g. image) over contentType, or to add a fallback for common image URL patterns
when contentType is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjs

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions