Responses being aggressively cached, preventing mutation operations
See original GitHub issueIssue Description
I’m seeing unexpected mutation behavior when attempting to use the simple example schema from the README. I have this in GraphQL playground:
mutation {
createMovie(input: {
title: "Test"
}) {
id
title
}
}
First execution worked as expected. Arango shows a new document and the GraphQL response shows the newly generated document ID.
However, attempts to run the same query a second time do NOTHING. I’ve refreshed the GraphQL playground and run again. The server console shows nothing at all.
Even worse, I removed the original document from the Arango admin and tried again. This time the Playground responded as if it had created the document, returning the same ID as before. I then went into Arango and checked. The document does NOT exist.
Is cruddl attempting to keep some type of in-memory cache that is out of sync with Arango?
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (6 by maintainers)
I just released 1.1.0-alpha.1, you can give it a try 😃
Sorry for all the trouble.
No, it’s not a client-side fix in the sense of a HTTP client. I thought you might have exactly the same problem as described in #82, where someone used ApolloClient on the server. If you don’t do that, then your situation is a bit different.
I just switched from graphql-yoga to apollo-server in cruddl and could reproduce your problem. It occurs because apparently ApolloServer caches the parsing result of the GraphQL query.
It’s not a caching feature in cruddl I could disable (cruddl has no caching feature). I was talking about he “feature” that one GraphQL query is always translated to one ArangoDB transaction. I don’t really want to disable that because it breaks important guarantees.
Instead, I’m going to three things:
ProjectOptions.getOperationIdentifier
. It allows you to generate a token object that can be used to unique define an operation. If you e.g. know that each request gets executed with a fresh context object, you can just return the context object as “operation identifier”.I’ll release an alpha version of cruddl when I implemented this so you can test.