nightire
nightire4d ago

Cannot use httpAction to send langgraph streaming events

I want to use httpAction to build an api for streaming events that produced by langgraph.js, below is what I do and errors I had encountered: 1. First, I made a very simple demo, only produce stream events by using langchain's openai model provider, is works fine 2. Next, I wrote a relative complex langgraph agent (I'm sure it works), this time convex throw an error to inform using "use node" 3. Since httpAction does not allow "use node", I extract all agent codes into a internal action 4. Then I invoke this internal action in httpAction to get the stream, and I saw this error:
8/19/2025, 5:16:00 AM [CONVEX A(survey/creator:testing)] Uncaught Error: IterableReadableStreamWithAbortSignal {"reader":"undefined","_abortController":{},"_reader":{}} is not a supported Convex type.

8/19/2025, 5:16:00 AM [CONVEX H(POST /testing)] Uncaught Error: Uncaught Error: IterableReadableStreamWithAbortSignal {"reader":"undefined","_abortController":{},"_reader":{}} is not a supported Convex type.
8/19/2025, 5:16:00 AM [CONVEX A(survey/creator:testing)] Uncaught Error: IterableReadableStreamWithAbortSignal {"reader":"undefined","_abortController":{},"_reader":{}} is not a supported Convex type.

8/19/2025, 5:16:00 AM [CONVEX H(POST /testing)] Uncaught Error: Uncaught Error: IterableReadableStreamWithAbortSignal {"reader":"undefined","_abortController":{},"_reader":{}} is not a supported Convex type.
It seems like I can't return a IterableReadableStreamWithAbortSignal object (which generated by langgraphagent.streamEvents method) through internalAction? What can I do to make it work? UPDATE: After a step-by-step debug, I can confirm the problem is caused by this line:
const agent = graph.compile()
const agent = graph.compile()
If I put this line in the httpAction, it errors because it depends on "node:async_hooks" which requires using "use node" directive If I move this line to an internalAction and return the result, Convex will complain CompiledStateGraph is not a supported Convex type I was trapped at this step, anyone can help me out?
2 Replies
Convex Bot
Convex Bot4d ago
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!
erquhart
erquhart3d ago
The arguments going into Convex functions and the return values going out must be serializable, and must conform to the allowable types for Convex function I/O. You can see a list of supported types here: https://docs.convex.dev/functions/validation#supported-types So you wouldn't be able to return a readable stream as is from a Convex function, only a serializable representation. I haven't worked with streaming so I'm not a ton of help, but the persistent text streaming component does give a working example of utilizing TransformStream to run streams through http actions in the Convex runtime (no "use node"), and persisting state in a serializable way through Convex functions: https://github.com/get-convex/persistent-text-streaming/blob/e080e1216dbfa5bdd730e80df30a243578685c81/src/client/index.ts#L87-L171

Did you find this page helpful?