Open
Description
Issue Description
Based on the Parse-Server documentation at https://docs.parseplatform.org/graphql/guide/#graphql, I am wondering if GraphQL subscriptions work out-of-the-box. So far in my testing, it doesn't work.
Steps to reproduce
- Create a class named "todo" with a new column "name"
- In parse-dashboard, go to GraphQL Console
- Write down this subscription query and hit the execute button:
subscription MySubscription {
todos {
edges {
node {
id
objectId
name
updatedAt
createdAt
}
}
}
}
- In another console tab, create a mutation as follow:
mutation MyMutation {
createTodo (input: {fields: {name: "hello world"}}) {
todo {
id
objectId
name
createdAt
updatedAt
}
}
}
- You can verify your newly created record with this query in a new console tab:
query MyTodos {
todos {
edges {
node {
id
objectId
name
createdAt
updatedAt
}
}
}
}
Expected Results
Once the subscription query is executed and running, every mutation result (related to the class in the subscription query) should be displayed on the result side of the console.
Actual Outcome
An error is displayed in the result side of the GraphQL console:
{
"error": "Could not connect to websocket endpoint ws://localhost:1337/graphql. Please check if the endpoint url is correct."
}
If I uncomment the following 2 lines in my docker-compose file (see at the end), I am not getting the above error, but just a console running and not displaying any result after a mutation:
- PARSE_SERVER_START_LIVE_QUERY_SERVER=true
- PARSE_SERVER_LIVE_QUERY={"classNames":["todo"]}
Environment Setup
-
Server
- parse-server version (Be specific! Don't say 'latest'.) : 4.2.0
- Operating System: windows 10
- Hardware: docker-compose file with following images:
- Postgres:12
- parseplatform/parse-server:4.2.0
- parseplatform/parse-dashboard:2.0.5
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): local docker-desktop for windows v.2.2.0.5
-
Database
- Postgres version: 12
- Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): local docker-desktop for windows v.2.2.0.5
Logs/Trace
Docker logs of my parse-server container:
PS D:\git\parse-platform> docker logs 65a
allowClientClassCreation: true
appId: APPLICATION_ID
cacheMaxSize: 10000
cacheTTL: 5000
customPages: {}
databaseURI: postgres://postgres:example@postgres:5432/postgres
enableAnonymousUsers: true
expireInactiveSessions: true
graphQLPath: /graphql
host: 0.0.0.0
logsFolder: ./logs
masterKey: ***REDACTED***
masterKeyIps: []
maxUploadSize: 20mb
mountGraphQL: true
mountPath: /parse
mountPlayground: true
objectIdSize: 10
playgroundPath: /playground
port: 1337
protectedFields: {"_User":{"*":["email"]}}
revokeSessionOnPasswordReset: true
schemaCacheTTL: 5000
sessionLength: 31536000
allowCustomObjectId: false
collectionPrefix:
directAccess: false
enableExpressErrorHandler: false
enableSingleSchemaCache: false
preserveFileName: false
preventLoginWithUnverifiedEmail: false
scheduledPush: false
verifyUserEmails: false
jsonLogs: false
verbose: false
level: undefined
serverURL: http://localhost:1337/parse
[1] parse-server running on http://localhost:1337/parse
[1] GraphQL running on http://localhost:1337/graphql
[1] Playground running on http://localhost:1337/playground
PS D:\git\parse-platform>
My docker-compose.yml file:
version: "3"
services:
# PostgreSQL image
postgres:
image: postgres:12
restart: always
container_name: my-postgres
volumes:
- db_data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=example
# parse-server application image
parse-server:
image: parseplatform/parse-server:4.2.0
restart: always
container_name: my-parse-server
environment:
- PARSE_SERVER_MASTER_KEY=MASTER_KEY
- PARSE_SERVER_APPLICATION_ID=APPLICATION_ID
- PARSE_SERVER_DATABASE_URI=postgres://postgres:example@postgres:5432/postgres
- PARSE_SERVER_MOUNT_GRAPHQL=true
- PARSE_SERVER_MOUNT_PLAYGROUND=true
#- PARSE_SERVER_START_LIVE_QUERY_SERVER=true
#- PARSE_SERVER_LIVE_QUERY={"classNames":["todo"]}
depends_on:
- postgres
links:
- postgres
ports:
- "1337:1337"
volumes:
- parseserverconfig:/parse-server/config
- parseservercloud:/parse-server/cloud
# parse-dashboard application image
parse-dashboard:
image: parseplatform/parse-dashboard:2.0.5
restart: always
container_name: my-parse-dashboard
ports:
- "4040:4040"
environment:
- PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1
- PARSE_DASHBOARD_CONFIG={"apps":[{"appId":"APPLICATION_ID","serverURL":"http://localhost:1337/parse","graphQLServerURL":"http://localhost:1337/graphql","masterKey":"MASTER_KEY","appName":"TestApp"}],"users":[{"user":"admin","pass":"admin"}]}
depends_on:
- parse-server
volumes:
# create named volume for postgreSQL /var/lib/postgresql/data so data persist when we shutdown/restart the container
db_data:
# create following named volumes so we do not have many anonymous volumes that keeps growing when we run command: docker volume ls
parseserverconfig:
parseservercloud: