From f2da2aaf2f082e0033a0442b4580c6562aed38b2 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Wed, 3 Jul 2024 21:45:45 +0200 Subject: [PATCH] [hive/app] fix graphql error `Must provide operation name if query contains multiple operations` when query contain 2 operations (#5115) Co-authored-by: Kamil Kisiela --- packages/web/app/src/server/lab.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web/app/src/server/lab.ts b/packages/web/app/src/server/lab.ts index c81b16651..06c23e23f 100644 --- a/packages/web/app/src/server/lab.ts +++ b/packages/web/app/src/server/lab.ts @@ -21,6 +21,7 @@ const LabBody = z.object({ required_error: 'Missing query', }), variables: z.record(z.unknown()).optional(), + operationName: z.string().optional(), }); export function connectLab(server: FastifyInstance) { @@ -110,14 +111,13 @@ export function connectLab(server: FastifyInstance) { document, variableValues: graphqlRequest.variables || {}, contextValue: {}, + operationName: graphqlRequest.operationName, }); void res.status(200).send(result); } catch (e) { req.log.error(e); - void res.status(200).send({ - errors: [e], - }); + void res.status(200).send({ errors: [e] }); } }); }