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

Unclear error message for using batchkey without enabling batching #2029

Closed
amitksingh1490 opened this issue May 26, 2024 · 4 comments
Closed
Labels
good first issue Good for newcomers. state: inactive No current action needed/possible; issue fixed, out of scope, or superseded.

Comments

@amitksingh1490
Copy link
Collaborator

The error message for enabling batching in upstream is not very clear if someone specifies the batchKey in the @http but forgets to enable batching in the @upstream directive.

Steps to Reproduce

Use this config and start the server

schema
@server(port: 8000)
@upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) {
  query: Query
}

type Query {
  posts: [Post] @http(path: "/posts")
}

type User {
  id: Int!
  name: String!
  username: String!
  email: String!
  phone: String
  website: String
}

type Post {
  id: Int!
  userId: Int!
  title: String!
  body: String!
  user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}], batchKey: ["id"])
}

Actual

 INFO File read: ./examples/jsonplaceholder_batch.graphql ... ok
 INFO N + 1 detected: 0
ERROR Invalid Configuration
Caused by:
  • GroupBy can only be applied if batching is enabled [at Post.user.@http]

Expected

 INFO File read: ./examples/jsonplaceholder_batch.graphql ... ok
 INFO N + 1 detected: 0
ERROR Invalid Configuration
Caused by:
  • "batchKey" can only be applied if batching is enabled in upstream [at Post.user.@http]
@amitksingh1490 amitksingh1490 added the good first issue Good for newcomers. label May 26, 2024
@bnchi
Copy link
Contributor

bnchi commented May 26, 2024

@amitksingh1490 just wondering is it a simple text change here

"GroupBy can only be applied if batching is enabled".to_string(),
or is there a specific conditions that needs to be met for this to get triggered ?

@amitksingh1490
Copy link
Collaborator Author

Just a text change now that you pointed out the code, there is another message
Valid::<(), String>::fail("GroupBy is only supported for GET requests".to_string())
Where we have wrong message here also

Copy link

Action required: Issue inactive for 30 days.
Status update or closure in 7 days.

@github-actions github-actions bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Jun 25, 2024
Copy link

github-actions bot commented Jul 2, 2024

Issue closed after 7 days of inactivity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers. state: inactive No current action needed/possible; issue fixed, out of scope, or superseded.
Projects
None yet
Development

No branches or pull requests

2 participants