nightireN
Convex Community7mo ago
6 replies
nightire

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.


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()


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?
Was this page helpful?