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.
Logs verifies blobFile
is actually blob too 'blob in chat>' 'audio/mpeg' 168480 'object'
4 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
the code you provided looks fine to me. to investigate:
- does the action file have "use node" at the top?
- how is
openaiTTS
defined?
my guess would be that the openai library is using a library like node-fetch instead of the built-in fetch. there's usually a way to override this in the library configuration, e.g. https://github.com/openai/openai-node?tab=readme-ov-file#customizing-the-fetch-clientGitHub
GitHub - openai/openai-node: Official JavaScript / TypeScript libra...
Official JavaScript / TypeScript library for the OpenAI API - openai/openai-node
Thank you for your investigation.
- yes it has
'use node';
on top
- import { generateBotResponse, openaiTTS } from './chat_shared'
;
chat_shared.ts
:
import 'openai/shims/web';
adding this to chat_shared.ts
fixed. Thank you so much 🙏great!
you could also try removing the
"use node";