From c848dd4146e85d065338bd13220e17c9f89df823 Mon Sep 17 00:00:00 2001 From: Dries Vandermeulen Date: Wed, 5 Sep 2018 15:22:01 +0200 Subject: [PATCH] Fix appolo-server-micro top level error response --- CHANGELOG.md | 1 + packages/apollo-server-micro/src/microApollo.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e535a7c0e6..507e881011e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All of the packages in the `apollo-server` repo are released with the same versi - Update `graphql-playground-html` to 1.7.4 [#1586](https://github.com/apollographql/apollo-server/pull/1586) - Add support for `graphql-js` v14 by augmenting typeDefs with the `@cacheControl` directive so SDL validation doesn't fail [#1595](https://github.com/apollographql/apollo-server/pull/1595) - Add `node-fetch` extensions typing to `RequestInit` [#1602](https://github.com/apollographql/apollo-server/pull/1602) +- Fix [#1581](https://github.com/apollographql/apollo-server/issues/1581) `apollo-server-micro` top level error response [#1619](https://github.com/apollographql/apollo-server/pull/1619) ### v2.0.5 diff --git a/packages/apollo-server-micro/src/microApollo.ts b/packages/apollo-server-micro/src/microApollo.ts index fa9fce87289..80a22a6720f 100644 --- a/packages/apollo-server-micro/src/microApollo.ts +++ b/packages/apollo-server-micro/src/microApollo.ts @@ -3,7 +3,7 @@ import { runHttpQuery, convertNodeHttpToRequest, } from 'apollo-server-core'; -import { json, RequestHandler } from 'micro'; +import { send, json, RequestHandler } from 'micro'; import * as url from 'url'; import { IncomingMessage, ServerResponse } from 'http'; @@ -66,7 +66,7 @@ export function graphqlMicro( error.statusCode = 500; } - throw error; + send(res, error.statusCode, error.message); } };