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

Relationships throwing error #3164

Closed
junaid33 opened this issue Jun 16, 2020 · 7 comments
Closed

Relationships throwing error #3164

junaid33 opened this issue Jun 16, 2020 · 7 comments

Comments

@junaid33
Copy link

junaid33 commented Jun 16, 2020

Bug report

Describe the bug

I'm trying to create relationships between multiple lists but the Admin UI is throwing an error.

To Reproduce

Steps to reproduce the behaviour. Please provide code snippets or a repository:

  1. Clone this repo: https://github.com/junaid33/ks-error-repro
  2. Add local postgres connection URL to .env
  3. npm install, npm run create-tables, npm run dev
  4. Go to localhost:3000/admin/graphql
  5. Enter this to create a user:

mutation {
createUser(
data: {
name: "Keystone"
email: "[email protected]"
password: "password"
}
) {
id
name
email
}
}

  1. Log into localhost:3000/admin using created log-in.
  2. Click on OrderItem, ChannelItem, and Match and you will see errors

Expected behaviour

OrderItem, ChannelIem, and Match should not have errors and should be able to be created.

Screenshots

These are screenshots on the error

Screen Shot 2020-06-16 at 5 36 25 PM

Screen Shot 2020-06-16 at 5 33 06 PM

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]

Additional context

Add any other context about the problem here.

@junaid33
Copy link
Author

May be related to: #2828

And it seems to work fine with MongoDB, just not Knex/Postgres

@junaid33
Copy link
Author

I was able to fix the "Cannot destructure propety 'rel' of 'fieldAdapter'" error. I didn't have the User relationship added to the ChannelItem and ShopItem. Once added, the error went away.

The

GraphQL error: select "t0".* from "public"."Match" as "t0" left outer join "public"."User" as "t0__user" on "t0__user"."id" = "t0"."user" where true and ("t0__user"."id" = $1) order by "input" ASC limit $2 - column "input" does not exist '

error is still there for the Match list. It works on Mongoose but throws error on Knex/Postgres.

@stale
Copy link

stale bot commented Oct 18, 2020

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

@stale stale bot added the needs-review label Oct 18, 2020
@josemf
Copy link
Contributor

josemf commented Jan 22, 2021

@junaid33 in case you are still wondering,

I did stumbled with this issue today and after some review I realized this is a bug that happens for lists which first field is a relationship and the relationship database id is a foreign key to the list (the table doesn't have the field).

This is fixed by changing some code in QueryBuilder { } class in adapter-knex.js.
I'll publish a PR soon.

@josemf
Copy link
Contributor

josemf commented Jan 22, 2021

#4704 #4704

@josemf
Copy link
Contributor

josemf commented Jan 26, 2021

#4719

Updated PR

@bladey
Copy link
Contributor

bladey commented Apr 8, 2021

Keystone 5 has officially moved into active maintenance mode as we push towards the next major new version Keystone Next, you can find out more information about this transition here.

In an effort to sustain the project going forward, we're cleaning up and closing old issues such as this one. If you feel this issue is still relevant for Keystone Next, please let us know.

@bladey bladey closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants