-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
GraphQL Support #5674
GraphQL Support #5674
Conversation
OMG, this is so cool! I guess this is something we could run along with a normal Parse Server instance right? So we can start writing new code with GraphQL support, while we use our legacy cloud fns? |
Yes. You're right! You can run rest and graphql apis at the same time over the same database. |
@davimacedo awesome! Has this been released already? Is there any docs written? |
A short getting started section was included here: https://github.com/parse-community/parse-server/#graphql The new Parse Server version was not yet released but it will probably be in the following few days. Meanwhile you can try it out from the master branch. I am working on a brand new /graphql/guide with more complete instructions to be included in the docs center. If you have the chance to play with it, please let me know any feedback you have. |
@davimacedo I'm considering using this graphQL feature for a web app upgrade I'm exploring for my product but when I follow the guide I get this error on startup:
Here is the code with sensitive data removed:
Long-time parse server in production running parse server 3.6.0. |
try:
|
Awesome, thanks @davimacedo. I made that change and then also had to make this change: The dev server starts up now, but both the playground and ParseDashboard can't reach the graphQL server. Playground says "Server cannot be reached"
|
In the code you shared there is not the line of code that mounts the playground. Can you share? Can you also share how you are starting the Parse Dashboard? You need to make sure that you are passing --graphQLServerURL to the correct endpoint. In your case it is |
Ah, getting closer. In the dashboard setup, I added the graphQLServerURL and it now appears in the Dashboard, but I still get the same error message:
Here's the code again (I removed playgrounds to focus on the Dashboard)
The first question I wanted to experiment with is does this support Roles and Users? IE could I build a web app that logs into Parse Server or provides credentials so that when the web app runs GraphQL queries, only the user's data is returned? I'm guessing this could be done with the X-Parse-Some-Header...maybe a session token? In the Dashboard this is set to the master key. |
Is the dashboard working for the other operations (through the REST API)? If yes. Just make sure that your are using the same dns and port for serverURL and graphQLServerURL. For example:
|
The config below should work properly:
|
Thanks @davimacedo, after changing names to match your sample, I still get the same error in the API Console:
Is there logging I can turn on somewhere to trap why the response is 500? |
Any error should be logged using the Parse default log system. Can you try to set verbose: true to parse server and check your logs? Are you mounting this to an existing database or is it a brand new one? Is the dashboard working properly for the other functionalities? Can you share again your current complete code? I am particularly interested in see all options you are passing to Parse Server and how you are starting your http server. |
I have the same one. Both of playground and dashboard are
I have followed this issue but not work for me. #6016 |
@buithuyen take a look at this discussion, it may be related #5761 |
You can also take a look in this guide: http://docs.parseplatform.org/graphql/guide/#using-expressjs It contains a complete example of how to run it using an Express.js applcation. |
Make sure that you are requiring Parse Server like this |
Thank you guys for your reply.
Replace
|
can you please share your package.json? |
@davimacedo Here you are. Do I have any mistake? {
"name": "parse-server-example",
"version": "1.4.0",
"description": "An example Parse API server using the parse-server module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-server-example"
},
"license": "MIT",
"dependencies": {
"express": "~4.11.x",
"kerberos": "~0.0.x",
"parse": "~1.8.0",
"parse-server": "*",
"parse-dashboard": "^1.0.24",
"graphql": "~14.5.4"
},
"scripts": {
"start": "node index.js"
},
"engines": {
"node": ">=4.3"
},
"resolutions": {
"graphql": "^14.5.4"
}
} |
I could reproduce the error with your current {
"name": "parse-server-example",
"version": "1.4.0",
"description": "An example Parse API server using the parse-server module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-server-example"
},
"license": "MIT",
"dependencies": {
"express": "~4.11.x",
"kerberos": "~0.0.x",
"parse-dashboard": "^2.0.1",
"parse-server": "^3.8.0"
},
"scripts": {
"start": "node index.js"
},
"engines": {
"node": ">=4.3"
}
} |
Could you deploy the example to Heroku?
Thank you for your kind help. |
Do you continue having this error with the package.json I sent you? Can you try to remove the node_modules folder and run npm install again? |
It still doesn't work. |
That's really strange. Can you confirm your Node.js and npm versions? |
Node version is |
I just remove
Everything is OK |
* GraphQL boilerplate * Create GraphQL schema without using gql * Introducing loaders * Generic create mutation * create mutation is now working for any data type * Create mutation for each parse class - partial * Adding more data types to the class * Get parse class query * Generic get query * Generic delete mutation * Parse class delete mutation * Parse class find mutation * Generic update mutation * Parse class update mutation * Fixing initialization problems * Installing node-fetch again * Basic implementation for Pointer * Constructor tests * API tests boilerplate * _getGraphQLOptions * applyGraphQL tests * GraphQL API initial tests * applyPlayground tests * createSubscriptions tests * ParseGrapjQLSchema tests file * ParseGraphQLSchema tests * TypeValidationError * TypeValidationError * parseStringValue test * parseIntValue tests * parseBooleanValue tests * parseDateValue tests * parseValue tests * parseListValues tests * parseObjectFields tests * Default types tests * Get tests * First permission test at generic Get operation * Fixing prepare data * ApolloClient does not work well with different queries runnning in paralell with different headers * ApolloClient does not work well with different queries runnning in paralell with different headers * User 3 tests * User 3 tests * Get level permission tests * Get User specific tests * Get now support keys argument * Get now supports include argument * Get now supports read preferences * Adding tests for read preference enum type * Find basic test * Find permissions test * Find where argument test * Order, skip and limit tests * Error handler * Find now supports count * Test for FindResult type * Improving find count * Find max limit test * Find now supports keys, include and includeAll * Find now supports read preferences * Basic Create test * Generic create mutation tests * Basic update test * UpdateResult object type test * Update level permissions tests * Error handler for default mutations * Delete mutation basic test * Delete mutation level permission tests * Test for string * String test * Date test * Pointer test * Relation tests * Changing objects mutations location * Changing objects queries location * Create file mutation * Test for file fields * Test for null values * Changing parse classes operations location * Objects mutations refactoring * Class specific create object mutation now working * Update class specific mutation now working * Specific class delete mutation now working * Get class specific mutation now working * Find class specific query now working without where and sort * Find query for custom classes working with where partially * Almost all data types working for specfic class find where * Now only missing relation, geopoint, file and ACL * Additional tests with Parse classes queries and mutations * Now only missing relation, geopoint, file and ACL * Files * Fiels are now working * Excluding missing order test temporarly * Refactoring dates * Refactoring files * Default types review * Refeactoring object queries * Refactoring class scalar type * Refactoring class types * Geo queries are now working * Fixing centerSphere * Allow sort on class specific queries * Supporting bytes * ACL constraint * Temporarly removing xit tests * Fixing some tests because of schema cache * Removing session token from users * Parse.User queries and mutations * Remove test using fit * Fixing include test that was failing because of schema cache * Fixing count test for postgres. Postgres does not count with where={} (legacy problem). We should solve it later * Fix null values test for postgres. It is evaluating null as undefined (legacy problem) and we should fix is later. * Fixing schema change test that was failing because of schema cache * Add GraphQL File type parseLiteral tests * Refeactoring users * Including sign up mutation * Fix failing test * Improve default GraphQL types tests coverage * Including some tests for data types * Including additional pointer test: * Fixing some tests * more data type tests * Include Bytes and Polygon data types tests * Polygons test * Merging other tests * Fixing some postgres tests
This PR aims to empower Parse Server with GraphQL support.
It contains a minimum set of queries and mutations to have a GraphQL API running on top of Parse Server, including: Auto Schema, Users Authentication/Authorization, Files, Class Objects supporting all data types and CRUD operations for MongoDB and Postgres.
Thanks to @douglasmuraoka for helping me on this.
There is still a lot of things that can be done, such as Cloud Code Functions, Subscriptions, and support to other Parse Server routes and we aim to keep working and sending new PRs.
The ParseGraphQLServer is an optional feature (such as ParseLiveQuery) that can play together with ParseServer or solo. The implementation includes a new set of files and do not change the current Parse Server implementation. A new set of specs were also included to keep the same coverage levels that we have in the repository.
Let me know about any question.