upstash / issues

Issue Tracker for Upstash
https://upstash.com
2 stars 0 forks source link

QStash multipart/form Error: Invalid UTF-8 in Binary Data #87

Closed ykunimoto closed 6 months ago

ykunimoto commented 6 months ago

I am attempting to use QStash to make requests to OpenAI's API (Whisper). However, when I include mp3 audio data in the Body using multipart/form, I receive the following error from QStash:

"failed to publish to url: failed to marshal message: string field contains invalid UTF-8"

Code Example

const formData = new FormData();
formData.append("file", blob, "audio.mp3");
formData.append("model", "whisper-1");

const response = await fetch(
    `https://qstash.upstash.io/v2/publish/https://api.openai.com/v1/audio/transcriptions`,
    {
    method: "POST",
    headers: {
        Authorization: `Bearer ${process.env.QSTASH_TOKEN}`,
        "Content-Type": "multipart/form-data",
        "Upstash-Method": "POST",
        "Upstash-Forward-Authorization": `Bearer ${OPENAI_API_KEY}`,
        "Upstash-Callback": `${MY_CALLBACK_URL}`,
    },
    body: formData,
    },
);

Is it not possible to include binary data in QStash's Body? Any insights into the error cause and potential solutions would be appreciated.

mdogan commented 6 months ago

Hi @ykunimoto,

Thanks for the report. There's a pending fix for this issue. It will hopefully deployed to prod servers very soon.

ykunimoto commented 6 months ago

Thanks, @mdogan ! Appreciate the quick response. Looking forward to the fix.

sancar commented 6 months ago

Hi @ykunimoto , we have deployed the fix. Now you should be able to publish with nonutf data as well.

sancar commented 6 months ago

@ykunimoto Closing the issue for now. Let us know if it doesn't work for you.

ykunimoto commented 6 months ago

Fixed! Thanks for the quick response!