apollo-server-lambda: Root ("/") path breaks server
See original GitHub issuePackage/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
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
@apatelvero This seems like a question about the
serverless
tool or AWS Lambda rather than anything Apollo Server specific. As of v3.0.1apollo-server-lambda
shouldn’t care much about URL paths, and in the almost-released v4 nothing in Apollo Server will care about URL paths.Do you know if there is anyway to remove the environment from end of the url
http://localhost:4001/dev
. I would just prefer to have localhost:4001/graphql instead of localhost:4001/dev/graphql