parse-community / parse-community/parse-server
Relation is resolved as column in graphQL and Postgres
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
Issue Description
I set up a Postgres instance with Parse and GraphQL. If I run a GraphQL query against my db that contains a relation, the relation is being resolved as a column instead of a relation causing a crash.
Steps to reproduce
- Setup a parse server + parse dashboard
- Enable GraphQL
- Connect to a Postgres instance
- Open the GraphQL playground inside the dashboard
- Execute the following query;
query Roles {
roles(first: 1) {
edges {
node {
users {
edges {
node {
username
}
}
}
}
}
}
}
Expected Results
I would expect to get an empty set of data since we have a clean Database.
Actual Outcome
Instead users is being resolved as a column and not a relation causing the following error;
"message": "error: column \"users\" does not exist",
Environment Setup
-
Server
- parse-server version (Be specific! Don't say 'latest'.) : 3.10.0
- Operating System: Ubuntu 18.04.3 LTS
- Hardware: 1 vCPUs, 1GB / 25GB Disk
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Digital Ocean
-
Database
- Postgres version: 10.10
- Storage engine: Digital Ocean Spaces
- Hardware: 1 vCPUs, 1GB / 25GB Disk
- Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): Digital Ocean
Logs/Trace
With Verbose on this is all I get;
Parse error: error: column "users" does not exist {"code":1,"stack":"Error: error: column \"users\" does not exist\n at /home/wouter/app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1179:21\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at async Object.findObjects (/home/wouter/app/node_modules/parse-server/lib/GraphQL/helpers/objectsQueries.js:149:24)\n at async resolve (/home/wouter/app/node_modules/parse-server/lib/GraphQL/loaders/parseClassQueries.js:139:18)"}
Aditional
It does work if I create the user column myself through PGAdmin. Then it correctly resolves the relation instead of the column. So it's either inside the schema or the resolver.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the GraphQL query with Parse Server 3.10.0 and Postgres, then trace the reported call path through lib/GraphQL/loaders/parseClassQueries.js, lib/GraphQL/helpers/objectsQueries.js, and lib/Controllers/DatabaseController.js. Check why the users relation is treated as a column; done means the query returns an empty set without the missing-column error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, javascript, node.js, postgresql
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100