Skip to content

apollo-server-lambda: Root ("/") path breaks server #5462

@Alec2435

Description

@Alec2435

Package/Version

This bug relates to apollo-server-lambda 3.0 (this issue did not appear in any 2.x releases)

Expected Behavior

apollo-server-lambda runs regardless of the specific http path used for it within the serverless.yml configuration.

Actual Behavior

I built an example based exactly on the steps found on the tutorial page with the only change being that I used an http path of / instead of graphql within serverless.yml. This is so that the GraphQL server runs at the root of the domain instead of at /graphql. When run, this results in the server responding to all requests with the following message:

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<title>Error</title>
</head>

<body>
	<pre>Cannot POST /</pre>
</body>

</html>

This does not happen if I revert back to a path of graphql.

In our use case, we simply had defaulted to using the root url for GraphQL and had done so with all previous releases, so we were hoping to keep the paradigm to avoid unnecessary changes to our client applications. It's my understanding that a path of / is the correct way to reference the root url within serverless configurations as it's worked before.

Reproduction Steps

An example for reproduction can be found at pearljobs/apollo-serverless-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    size/smallEstimated to take LESS THAN A DAY

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions