Mastra Migration (0.24.6 to 1.0.0-beta.9): FilePart to chatRoute stream not working anymore

We are currently migrating from Mastra version 0.24.6 to 1.0.0-beta.9.
We previously managed to attach files to our chat messages with this code:

this.chat?.sendMessage({
      text: userInput.message,
      files: userInput.files && userInput.files.length > 0 ? (userInput.files as any) : undefined,
    });


Where userInput.files is an array of FilePart objects like:
const filePart: FilePart = {
        type: 'file',
        mediaType,
        data: publicUrl,
        filename: fileName,
      };


The issue is that data is not a base64 url, but a real public url like, for example, https://fastly.picsum.photos/id/966/200/300.jpg?hmac=vBALR2x0cV-keVNLecwjd8ZluSHv17AHDvpiYjBqar0

Previously this worked perfectly, the Mastra server was able to process it and answer accordingly, but now we are getting this error:
AI_APICallError: Invalid 'input[3].content[0].image_url'. Expected a base64-encoded data URL with an image MIME type (e.g. 'data:image/png;base64,aW1nIGJ5dGVzIGhlcmU='), but got empty base64-encoded bytes.

I know from reading the AI SDK documentation that the data part should be base64, but I can't figure out why the problem only started happening after the migration.

Can you help us?
Thank you in advance
Was this page helpful?