Skip to content
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

Relation is resolved as column in graphQL and Postgres #6419

Open
Wouter125 opened this issue Feb 18, 2020 · 4 comments
Open

Relation is resolved as column in graphQL and Postgres #6419

Wouter125 opened this issue Feb 18, 2020 · 4 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@Wouter125
Copy link

Wouter125 commented Feb 18, 2020

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

  1. Setup a parse server + parse dashboard
  2. Enable GraphQL
  3. Connect to a Postgres instance
  4. Open the GraphQL playground inside the dashboard
  5. 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.

@davimacedo davimacedo added the type:bug Impaired feature or lacking behavior that is likely assumed label Feb 19, 2020
@stale
Copy link

stale bot commented Nov 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 8, 2020
@mtrezza mtrezza removed the stale label Nov 8, 2020
@cjbland
Copy link
Contributor

cjbland commented Mar 14, 2021

Is the workaround in the description the recommended solution? I have run into this as well. Here's the GraphQL query we are trying to execute:

roles(where: { users: { have: { id: { equalTo: $userId } } } }) {
  edges {
    node {
      name
      users {
        edges {
          node {
            username
          }
        }
      }
    }
  }
}

And it results in this message from the server:

{
  "errors": [
    {
      "message": "error: column \"users\" does not exist",
      "locations": [{ "line": 19, "column": 3 }],
      "path": ["roles"],
      "extensions": { "code": 1 }
    }
  ],
  "data": null
}

EDIT: Similar operating environment as the original post, using PostgreSQL running in AWS RDS and parse-server v4.5.0

@davimacedo
Copy link
Member

@cjbland would you be willed to help fixing this bug?

@cjbland
Copy link
Contributor

cjbland commented Mar 15, 2021

Sure, I'll take a stab at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

4 participants