Skip to content

GraphQL playground throws "Server cannot be reached" error #6897

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

Closed
4 tasks done
185driver opened this issue Sep 8, 2020 · 4 comments
Closed
4 tasks done

GraphQL playground throws "Server cannot be reached" error #6897

185driver opened this issue Sep 8, 2020 · 4 comments

Comments

@185driver
Copy link

New Issue Checklist

Issue Description

When deploying a minimal parse-server project to heroku utilizing graphql, the playground throws a "Server cannot be reached" error. The parse server itself is functional using the rest api, but not the graphql playground.

Steps to reproduce

  1. Clone my repro repo: https://github.com/185driver/parse-graphql-issue
  2. Deploy to heroku dyno using instructions in README.md
  3. Navigate to the serverURL/playground and note the error.

Actual Outcome

  1. Playground URL shows :"Server cannot be reached".
    image
  2. Heroku logs --tail shows:
error: Error: Expected RoleConnection to be a GraphQL nullable type.
app[web.1]: at assertNullableType (/app/node_modules/parse-server/node_modules/graphql/type/definition.js:425:11)
app[web.1]: at new GraphQLNonNull (/app/node_modules/parse-server/node_modules/graphql/type/definition.js:377:19)
app[web.1]: at Object.load (/app/node_modules/parse-server/lib/GraphQL/loaders/parseClassQueries.js:109:13)
app[web.1]: at /app/node_modules/parse-server/lib/GraphQL/ParseGraphQLSchema.js:109:25
app[web.1]: at Array.forEach (<anonymous>)
app[web.1]: at ParseGraphQLSchema.load (/app/node_modules/parse-server/lib/GraphQL/ParseGraphQLSchema.js:107:71)
app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:97:5)
app[web.1]: at async ParseGraphQLServer._getGraphQLOptions (/app/node_modules/parse-server/lib/GraphQL/ParseGraphQLServer.js:61:17)
app[web.1]: at async /app/node_modules/parse-server/lib/GraphQL/ParseGraphQLServer.js:99:86
  1. Dev tools console shows:
    image

Expected Outcome

The playground should not throw an error.

Environment

    "express": "4.17.1",
    "parse-server": "4.3.0"

Server

  • Parse Server version: 4.3.0
  • Operating system: Windows 10
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Heroku

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.2.8
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): N/A
  • SDK version: N/A

Logs

Additional Info

If I deploy the parse-dashboard in combination with parse-server, I get the same results.

  1. Parse server works and is accessible in the browser, but if I navigate to the GraphQL API Console, I get the same errors.

If I deploy using PostGres instead of MongoDB, I get the same results.

@davimacedo
Copy link
Member

Thanks for reporting. Do you have the same result if you run it in your local machine?

@185driver
Copy link
Author

I had not tested it locally, so thanks for that suggestion. As it turns out, doing so led to what appears to be the main issue for me and its resolution. I use yarn (1.x) rather than npm, so by installing locally, a yarn.lock file was created. After that, deploying locally works great.

Additionally, deploying to heroku with the yarn lock file as part of the deploy resolved the issue there too. The graphql playground now works both locally and on heroku. I also tested this scenario using parse-dashboard and it resolved my issue there with the GraphQL API Console (same error earlier).

Next, I removed the yarn.lock file and deployed again. Same error as before, so no joy.

Lastly, I used npm install so as to create a package-lock.json file instead of the yarn version. The deploy failed both locally and on heroku in terms of using the GraphQL server and playground, although parse-server itself still works.

To sum up, it does not appear that parse-server itself is causing the issue, nor is heroku. The culprit appears to be that the npm installs are mishandling something (related to graphql dependencies or versions, maybe?) while yarn is handling things better. For my part, this issue can be closed since the error is no longer throwing, but if my experience is not unique, maybe a mention in the docs of this problem or solution would be helpful to others. Thanks for your help.

@davimacedo
Copy link
Member

Thanks for the detailed reporting. I will keep an eye on that.

@cjbland
Copy link
Contributor

cjbland commented Feb 27, 2021

FWIW I am having this exact issue running parse-server v4.5.0 via Express with GraphQL (also deploy using PostgreSQL). If it makes a difference I have the "engines" in my package.json set to:

"engines": {
  "node": "~14",
  "npm": "6.13.x"
}

I have a Dockerfile and I deploy to AWS ECS and am using npm when building the container. Any thoughts would be appreciated.

EDIT: For anyone else coming here from Google, here's the related issue with parse-dashboard: parse-community/parse-dashboard#1656

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

3 participants