fix: convert Web API ReadableStream to Node.js Readable for Fastify
graphql-yoga's handleNodeRequestAndResponse returns a Response with a Web API ReadableStream body. Fastify's reply.send() requires a Node.js Readable stream, causing all GraphQL requests to hang indefinitely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import fastifyCors from "@fastify/cors";
|
||||
import fastifyMultipart from "@fastify/multipart";
|
||||
import fastifyStatic from "@fastify/static";
|
||||
import { createYoga } from "graphql-yoga";
|
||||
import { Readable } from "stream";
|
||||
import path from "path";
|
||||
import { schema } from "./graphql/index";
|
||||
import { buildContext } from "./graphql/context";
|
||||
@@ -69,7 +70,7 @@ async function main() {
|
||||
for (const [key, value] of response.headers.entries()) {
|
||||
reply.header(key, value);
|
||||
}
|
||||
return reply.send(response.body);
|
||||
return reply.send(Readable.from(response.body));
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user