From 2aca3b8e2ec003a98e97e10df2c3037599d31307 Mon Sep 17 00:00:00 2001 From: Kamil Kisiela Date: Tue, 14 Jun 2022 10:42:29 +0200 Subject: [PATCH] Temporarily support graphql-client-vesion header (#139) Our CLI sent a header with a typo. We'll support both for next 30 days or more to collect correct versions. After that, we will drop the header and use SchemaPublishMissingServiceError in schemaPublish mutation by default. --- packages/services/server/src/graphql-handler.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/services/server/src/graphql-handler.ts b/packages/services/server/src/graphql-handler.ts index bab1bbc34..13d07eaa8 100644 --- a/packages/services/server/src/graphql-handler.ts +++ b/packages/services/server/src/graphql-handler.ts @@ -117,7 +117,14 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth endpoint: process.env.HIVE_USAGE_ENDPOINT, clientInfo(ctx: { req: FastifyRequest; reply: FastifyReply }) { const name = ctx.req.headers['graphql-client-name'] as string; - const version = (ctx.req.headers['graphql-client-version'] as string) ?? 'missing'; + const version = + ((ctx.req.headers['graphql-client-version'] as string) || + // Our CLI sent a header with a typo. + // We'll support both for next 30 days or more to collect correct versions. + // After that, we will drop the header + // and use SchemaPublishMissingServiceError in schemaPublish mutation by default. + (ctx.req.headers['graphql-client-vesion'] as string)) ?? + 'missing'; if (name) { return { name, version };