Using the GRANDstack Starter template project, I'm using apollo-server in combination with neo4j. I have a CreateParticipant
mutation (defined in the schema.graphql with a @cypher directive) that I want to reuse for a new mutation.
The simplified resolver that gets passed into the augmented schema looks like this:
const resolvers = {
Mutation: {
UploadCSV: async (parent, { file }, context, info) => {
// some data processing using file omitted
const payload = { name: 'Just a name' }
const result = resolvers.Mutation.CreateParticipant(
parent,
payload,
context,
info
)
return 'thanks StackOverflow'
},
},
}
The mutations are defined in the schema.graphql file like this:
CreateParticipant(name: String!, id: ID = null): Participant
@cypher(
statement: """
CREATE (par:Participant {
name: $name,
id: coalesce($id, apoc.create.uuid())
})
RETURN par
"""
)
UploadCSV(file: Upload!): String
When I try to upload a file now via the frontend, apollo-server throws an error when executing resolvers.Mutation.CreateParticipant(parent, payload, context, info)
. Payload is an object with key/value pairs that the mutation expects.
The thrown error is:
Error: Do not know how to handle this type of mutation. Mutation does not follow naming convention.
I'm wondering if passing the unmodified info
is the reason this isn't working.