diff --git a/CHANGELOG.md b/CHANGELOG.md index 402eb2003f4..175752ef338 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 - express, koa: remove next after playground [#1436](https://github.com/apollographql/apollo-server/pull/1436) - Hapi: Pass the response toolkit to the context function. [#1407](https://github.com/apollographql/apollo-server/pull/1407) - update apollo-engine-reporting-protobuf to non-beta [#1429](https://github.com/apollographql/apollo-server/pull/1429) +- Lambda: Look in event.path first when picking endpoint for GraphQL Playground [#1527](https://github.com/apollographql/apollo-server/pull/1527) ### rc.10 diff --git a/packages/apollo-server-lambda/src/ApolloServer.ts b/packages/apollo-server-lambda/src/ApolloServer.ts index 94a58c059dc..1949a43f25f 100644 --- a/packages/apollo-server-lambda/src/ApolloServer.ts +++ b/packages/apollo-server-lambda/src/ApolloServer.ts @@ -119,8 +119,13 @@ export class ApolloServer extends ApolloServerBase { if (this.playgroundOptions && event.httpMethod === 'GET') { const acceptHeader = event.headers['Accept'] || event.headers['accept']; if (acceptHeader && acceptHeader.includes('text/html')) { + const path = + event.path || + (event.requestContext && event.requestContext.path) || + '/'; + const playgroundRenderPageOptions: PlaygroundRenderPageOptions = { - endpoint: event.requestContext.path, + endpoint: path, ...this.playgroundOptions, };