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

Can't use Where clause in GraphIQL #14627

Closed
DJ-Paxton opened this issue Nov 3, 2023 · 3 comments · Fixed by #16364
Closed

Can't use Where clause in GraphIQL #14627

DJ-Paxton opened this issue Nov 3, 2023 · 3 comments · Fixed by #16364
Labels
Milestone

Comments

@DJ-Paxton
Copy link

I'm using Orchard as a Headless CMS and consuming the data from other sites via GraphQL api.
I have a News type with some basic fields and a List part of Articles which have some other basic fields.
So far I've been able to fetch all the articles to show a short description and an image and save the contentItemId

image

The thing is when I use that id in a Where to show the whole article.

{
  newsArticle(
    status: LATEST
    where: {contentItemId: "4pptm00vkzdr223wm2pnwtfa5y"}
  ) {
    shortDescription
    displayText
    tileImage {
      urls
    }
    archive
    contentItemId
  }
}

And it will crash with that multi-part identifier error

image

I tried to filter using Alias insted of the contentItemId but it's the same.

At the moment I'm fetching all the articles, and filtering the JSON response in my client sites but that's just temporary (I hope)
I've seen a similar problem in #3699 and I'm using multitenancy too but I understand that it's solved.

Any ideas? Thanks!

@DJ-Paxton
Copy link
Author

Update:
I found that in the same solution but with the default Tenant, the where clause works just fine.

And giving a look at the database, I'm seeing that the table names don't match.

image

Somehow GraphQl is adding a _a1 to the Tenant.TableName query.

I'll try to replicate the issue in the Core solution to be able to debug it and try to figure it out.
In the meantime if is there any known solution or any ideas it'll be much apreciated.

@DJ-Paxton
Copy link
Author

Update2:
I did not solved the issue yet.
But I found how it works:

First of all, I'm using SqlServer and I don't know if this problem exists for other db types.
When creating a new Tenant I'm choosing the SAME database to be able to share content types across the platform, and I'm giving a Table Schema to separate the tables and here is where this _a1 is appearing in the GraphQl queries.

Options to work around this:

  • Using a different database won't crash the query
  • If using a different DB is not an option, instead of giving a Table Schema to the Tenant, I found that it'll work correctly by using Table Prefix instead.

I hope this helps someone even if the issue is not fixed

@sebastienros
Copy link
Member

So I assume to repro the issue we need to test with schemas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants