Comments (8)
Right!
With this query:
{
battles {
id
videos_func { count }
}
}
The response is:
{
"errors": [
{
"message": "An unexpected error occurred.",
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
]
}
And the error is:
ERROR: select "battles"."id", (select count(*) from "videos" as "kaggh" left join "matchdays" as "jjvhv" on "videos"."matchday" = "jjvhv"."id" left join "battles" as "xcswd" on "videos"."battle" = "xcswd"."id" where "kaggh"."battle" = "battles"."id" and ((("jjvhv"."status" = 'published' or "xcswd"."status" = 'published')))) AS "videos_count" from "battles" where (("battles"."status" = $1)) order by "battles"."id" asc limit $2 - invalid reference to FROM-clause entry for table "videos"
From:
ERROR: select "battles"."id", (select count(*) from "videos" as "kaggh" left join "matchdays" as "jjvhv" on "videos"."matchday" = "jjvhv"."id" left join "battles" as "xcswd" on "videos"."battle" = "xcswd"."id" where "kaggh"."battle" = "battles"."id" and ((("jjvhv"."status" = 'published' or "xcswd"."status" = 'published')))) AS "videos_count" from "battles" where (("battles"."status" = $1)) order by "battles"."id" asc limit $2 - invalid reference to FROM-clause entry for table "videos"
err: {
"type": "GraphQLError",
"message": "select \"battles\".\"id\", (select count(*) from \"videos\" as \"kaggh\" left join \"matchdays\" as \"jjvhv\" on \"videos\".\"matchday\" = \"jjvhv\".\"id\" left join \"battles\" as \"xcswd\" on \"videos\".\"battle\" = \"xcswd\".\"id\" where \"kaggh\".\"battle\" = \"battles\".\"id\" and (((\"jjvhv\".\"status\" = 'published' or \"xcswd\".\"status\" = 'published')))) AS \"videos_count\" from \"battles\" where ((\"battles\".\"status\" = $1)) order by \"battles\".\"id\" asc limit $2 - invalid reference to FROM-clause entry for table \"videos\"",
"stack":
error: select "battles"."id", (select count(*) from "videos" as "kaggh" left join "matchdays" as "jjvhv" on "videos"."matchday" = "jjvhv"."id" left join "battles" as "xcswd" on "videos"."battle" = "xcswd"."id" where "kaggh"."battle" = "battles"."id" and ((("jjvhv"."status" = 'published' or "xcswd"."status" = 'published')))) AS "videos_count" from "battles" where (("battles"."status" = $1)) order by "battles"."id" asc limit $2 - invalid reference to FROM-clause entry for table "videos"
at Parser.parseErrorMessage (/directus/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/dist/parser.js:283:98)
at Parser.handlePacket (/directus/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/dist/parser.js:122:29)
at Parser.parse (/directus/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/dist/parser.js:35:38)
at Socket.<anonymous> (/directus/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
"path": [
"battles"
],
"locations": [
{
"line": 2,
"column": 3
}
],
"extensions": {}
}
Using PostgreSQL v15.
And the collection is (both matchday & video are M2O):
![Screenshot 2024-05-09 at 7 03 21 AM](https://private-user-images.githubusercontent.com/1007051/329223466-2659aa0c-4a65-4310-ada2-323b8c29851c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc2NjA5MDksIm5iZiI6MTcxNzY2MDYwOSwicGF0aCI6Ii8xMDA3MDUxLzMyOTIyMzQ2Ni0yNjU5YWEwYy00YTY1LTQzMTAtYWRhMi0zMjNiOGMyOTg1MWMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MDZUMDc1NjQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTk3YjAxNTIwN2IzNjk4OGM4ZDdmNjEwMDJjN2M4ODJjODE2MGU0MzcxYzNjNDJkMDNlOGEzYTQ5OWNjNzlkNiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.Z-HpCBlhmJX4agpBq2YDkIdDjUC7lEYd6LEL3KqzZQk)
from directus.
Yes, no custom hooks / flows related to this query.
from directus.
The missing piece to reproducing this were the Item Permissions
for the videos
collection. With this filter I can reproduce the error. And this looks like a regression caused in #22297.
{
"_and": [{
"_or": [{
"battle": {
"status": {
"_eq": "published"
}
}
}, {
"matchday": {
"status": {
"_eq": "published"
}
}
}]
}]
}
from directus.
Right, in my matchdays and battle collections I have the status field. And in the permission I required to published.
The videos has no status field.
from directus.
Heya, I've tried replicating this in v10.11.0 on my end, but so far my GraphQL queries seem to work just find for m2m, m2a and o2m relations.
Can you please share your collection setup, DB vendor and maybe even a stack trace you might be seeing in your Directus logs?
from directus.
Are you seeing this in the app or when querying the API? Because the DB query looks like some additional filters are applied?
It would help if you could share the whole request. Thank you!
from directus.
Just with the query:
POST /graphql
Payload:
{"query":"{\n battles {\n id\n videos_func { count }\n }\n}","variables":null}
from directus.
Just to double check, you're not using any custom hooks or flows that might transform that query before it hits the DB?
from directus.
Related Issues (20)
- Permissions error when using pg_restore HOT 5
- Environment variables: AUTH_<PROVIDER>_FIRST_NAME_KEY and AUTH_<PROVIDER>_LAST_NAME_KEY do not work HOT 2
- ERRNO 1 : SQLITE error when trying to crop or edit an image. HOT 1
- ROUTE_NOT_FOUND - Verify a Registration HOT 4
- Cannot load extension bundle on windows after updating Directus from 10.8.3 to 10.11.1 HOT 2
- Implement `meta` support in the SDK
- TypeError : Invalid URL, when loading directus bundle extension in directus version 10.11.2 on windows HOT 5
- Setting a preset for all users isn't working properly.
- Upload file via API returns 204 and empty body
- M2M uses wrong relation if two M2M relations use the same junction table
- Unable to Promote Version HOT 2
- Showing a nice structured JSON in "Log to Console" Logs HOT 1
- Throw errors when present from sdk
- How to create or delete user by only admin approval HOT 1
- why I am use .with(staticToken('staticToken')) tip Invalid user credentials HOT 3
- Manual sorting in M2M interface table layout is not obvious HOT 2
- Graphql errors getting swallowed by the SDK
- Applying a schema does not seem to invalidate the schema cache HOT 1
- Unable to Update Directus in Digital Ocean HOT 2
- Incomplete Display of Related Items in M2M Relationship
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from directus.