elide
elide copied to clipboard
Cryptic error message on data passed to child entity
Model
public class Incident {
@ManyToOne
@JoinColumn(name = "last_edited_by")
@CreatePermission(expression = Constants.USER_VALID)
@UpdatePermission(expression = Constants.USER_VALID)
private User last_edited_by;
...
}
public class User {
private String id;
...
}
Expected Behavior
Request:
{
"query": "mutation {incidents(op: UPSERT, data: {}) { last_edited_by(op: UPSERT data: {id:\"invalidUserId\"}) { edges { node { id } } } } } } }"
}
Reasonable response:
{
"data": null,
"errors": [
{
"message": "Exception while fetching data (/incidents/edges[0]/node/last_edited_by) : null",
"locations": [
{
"line": 1,
"column": 358
}
],
"path": [
"incidents",
"edges",
0,
"node",
"last_edited_by"
]
}
]
}
Current Behavior
When passing data values to child entity from the parent entity's data, the response is cryptic. Broken request:
{
"query": "mutation {incidents(op: UPSERT, data: {created_by: {id:\"invalidUserId\"}}) { last_edited_by { edges { node { id } } } } } } }"
}
Broken response:
{
"data": null,
"errors": [
{
"message": "Exception while fetching data (/incidents) : null",
"locations": [
{
"line": 1,
"column": 79
}
],
"path": [
"incidents"
]
}
]
}
Stacktrace:
2020-07-29 22:01:33.238 +0000 [qtp288615534-335] [App, ] DEBUG com.yahoo.elide.graphql.QueryRunner.executeGraphQLRequest - WebApplicationException
javax.ws.rs.WebApplicationException: HTTP 200 OK
at com.yahoo.elide.graphql.QueryRunner.executeGraphQLRequest(QueryRunner.java:191)
at com.yahoo.elide.graphql.QueryRunner.lambda$run$0(QueryRunner.java:104)
at com.yahoo.elide.graphql.QueryRunner.run(QueryRunner.java:139)
at com.yahoo.elide.spring.controllers.GraphqlController.post(GraphqlController.java:58)
Possible Solution
Steps to Reproduce (for bugs)
- Create table with Data Model listed above.
- Send a mutation request as specified above.
Context
Difficult to debug invalid insert values.
Your Environment
- Elide version used: 4.64
- Environment name and version (Java 1.8.0_152): OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
- Operating System and version: RHEL 7
- Link to your project:
@codingwhatever GraphQL error handling was improved greatly in Elide 5. Can you rerun with Elide 5?
@codingwhatever what was the actual error in this case? Did it fail for permissions or are you providing an invalid user ID? I"m not sure how to reproduce the failure in this case.
Also - is there an ID field in the Incident model?