I have the following docker-compose:
version: '3.9'
services:
database:
image: mongo:6.0.2
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
volumes:
- ${HOME}/_DOCKER_DATA_/database:/data/db
server:
restart: always
image: parseplatform/parse-server:5.3.0
ports:
- 1337:1337
environment:
- PARSE_SERVER_APPLICATION_ID=APP_ID
- PARSE_SERVER_APPLICATION_NAME=COOK_NAME
- PARSE_SERVER_MASTER_KEY=MASTER_KEY
- PARSE_SERVER_DATABASE_URI=mongodb://admin:admin@mongo/parse_server?authSource=admin
- PARSE_SERVER_URL=http://10.0.2.2:1337/parse
- PARSE_SERVER_MOUNT_GRAPHQL=true
- PARSE_SERVER_CLOUD=/parse-server/cloud/main.js
links:
- database:mongo
volumes:
- ${HOME}/_DOCKER_DATA_/server:/data/server
- ../cloud:/parse-server/cloud
dashboard:
image: parseplatform/parse-dashboard:5.0.0
ports:
- "4040:4040"
depends_on:
- server
environment:
- PARSE_DASHBOARD_APP_ID=COOK_APP
- PARSE_DASHBOARD_MASTER_KEY=MASTER_KEY_1
- PARSE_DASHBOARD_USER_ID=admin
- PARSE_DASHBOARD_USER_PASSWORD=admin
- PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=true
- PARSE_DASHBOARD_SERVER_URL=http://localhost:1337/parse
- PARSE_DASHBOARD_GRAPHQL_SERVER_URL=http://localhost:1337/graphql
volumes:
- ${HOME}/_DOCKER_DATA_/dashboard:/data/dashboard
And also the fallowing .graphqlconfig
in the root of my project:
{
"name": "Untitled GraphQL Schema",
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"Default GraphQL Endpoint": {
"url": "http://localhost:1337/graphql",
"headers": {
"X-Parse-Application-Id": "APP_ID",
"X-Parse-Master-Key": "MASTER_KEY"
},
"introspect": true
}
}
}
}
inside of my root project I have a folder called "cloud" which has inside a main.js and also a schema.graphql.
Main.js:
Parse.Cloud.define("checkGraphQLSupport", async req => {
if (parseGraphQLServer){
return "This App has GraphQL support.";
} else {
return "This App does not have GraphQL support. Wrong Parse version maybe?";
}
});
schema.graphql
extend type Query {
checkGraphQLSupport: String! @resolve(to: "checkGraphQLSupport")
}
I am trying to call from http://0.0.0.0:4040/apps/COOK_APP/api_console/graphql the cloud function via graphql by using the following query:
query {
checkGraphQLSupport
}
But this is not working and I get the fallowing error message:
"Cannot query field "checkGraphQLSupport" on type "Query"."
Can anyone explain to me what I am doing wrong? All what I am trying to do is to call the cloud code using graphql.
Try to add the env var PARSE_SERVER_GRAPH_QLSCHEMA=/parse-server/cloud/schema.graphql