DegiD
Convex Community12mo ago
6 replies
Degi

Storing generated audio file doesn't work in action. Same code works fine in HTTP action.

Getting: "store() expects a Blob. If you are trying to store a Request, await request.blob() will give you the correct input." error but I am sure that I pass blob.
  try {
      const ttsResponse = await openaiTTS(botText);
      console.log('ttsResponse', ttsResponse.status, ttsResponse.statusText);
      const blobFile = await ttsResponse.blob();
      console.log('blob in chat>', blobFile.type, blobFile.size, typeof blobFile);
      const id = await ctx.storage.store(blobFile);
      await ctx.runMutation(internal.messages.update, {
        messageId: botMessageId,
        patch: { audioFileId: id },
      });
    } catch (e) {
      console.error('Error storing audio file', e, (e as Error).message);
    }

Logs verifies blobFile is actually blob too 'blob in chat>' 'audio/mpeg' 168480 'object'
Was this page helpful?