Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apollo Server 3 - doesn't work #1256

Closed
nova93 opened this issue Jul 28, 2021 · 2 comments
Closed

Apollo Server 3 - doesn't work #1256

nova93 opened this issue Jul 28, 2021 · 2 comments

Comments

@nova93
Copy link

nova93 commented Jul 28, 2021

Bug Report

Brand-new project created today (28th July 2021), using the starter script (https://www.apollographql.com/docs/apollo-server/deployment/lambda/). Nothing added, not even middleware, doesn't work locally at all, with no errors showing in the console.

Current Behavior
locally npm run dev:
GET: Cannot GET null (404)
POST (through Postman): Cannot POST null (404)

deployed
works just fine, as expected

Sample Code
https://github.com/nova93/apollo-3-test

Expected behavior/code
Expect the deployed version to work the same locally (in this case, a landing page linking to Apollo Sandbox), and Postman queries to return the same as deployed (in this case Hello world!)

Environment

  • serverless version: 2.52.1
  • serverless-offline version: tried latest 8.0.0 and 7.1.0, same story
  • node.js version: v14.17.1
  • OS: macOs 10.15.7 Catalina

Possible Solution

I believe it might be something with the total rewrite of AS3, and their use of the 3rd party package to convert Lambda to Express-type requests.
This thread talks about their changes, and decisions: apollographql/apollo-server#5415

@tloyan
Copy link

tloyan commented Aug 7, 2021

Same Issue for me, I think this issue is about default URL.
I've made change in serverless.yml file by changing default url path by something else like path: /graphql.
Now all work for me, locally and deployed.

before:

- http:
          path: /
          method: post
          cors: true

after:

- http:
          path: /graphql
          method: post
          cors: true

I hope this help you solve your issue

@nova93
Copy link
Author

nova93 commented Sep 2, 2021

Thanks for that! It works nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants