fix: convert Web API ReadableStream to Node.js Readable for Fastify
Some checks failed
Build and Push Backend Image / build (push) Failing after 26s
Build and Push Frontend Image / build (push) Successful in 4m17s

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:
2026-03-04 20:11:08 +01:00
parent ed7ac0c573
commit 012bb176d9

View File

@@ -4,6 +4,7 @@ import fastifyCors from "@fastify/cors";
import fastifyMultipart from "@fastify/multipart"; import fastifyMultipart from "@fastify/multipart";
import fastifyStatic from "@fastify/static"; import fastifyStatic from "@fastify/static";
import { createYoga } from "graphql-yoga"; import { createYoga } from "graphql-yoga";
import { Readable } from "stream";
import path from "path"; import path from "path";
import { schema } from "./graphql/index"; import { schema } from "./graphql/index";
import { buildContext } from "./graphql/context"; import { buildContext } from "./graphql/context";
@@ -69,7 +70,7 @@ async function main() {
for (const [key, value] of response.headers.entries()) { for (const [key, value] of response.headers.entries()) {
reply.header(key, value); reply.header(key, value);
} }
return reply.send(response.body); return reply.send(Readable.from(response.body));
}, },
}); });