Open wesselvdv opened 1 year ago
Could you share some code about what you mean, do you mean fieldArgs.get("<unknown>")
or fieldArgs.$unknown
or...? What do you mean by a "mutation FieldArgs" - the FieldArgs of a mutation field's plan resolver?
Could you share some code about what you mean, do you mean
fieldArgs.get("<unknown>")
orfieldArgs.$unknown
or...? What do you mean by a "mutation FieldArgs" - the FieldArgs of a mutation field's plan resolver?
import { gql, makeExtendSchemaPlugin } from "postgraphile/utils"
export const MutationErrorPlugin = makeExtendSchemaPlugin(() => {
return {
typeDefs: gql`
input Input {
id: UUID!
}
type Payload {
query: Query
}
extend type Mutation {
doSomething(input: Input!): Payload!
}
`,
plans: {
Mutation: {
doSomething: (_, fieldArgs) =>
// error because ids doesn't exist
fieldArgs.get(["input", "ids"]),
},
},
}
})
Summary
Getting an incorrect field from a mutation FieldArgs results in a
unable to get type from undefined
error.Steps to reproduce
Try and get an absent field from a FieldArgs
Expected results
More verbose error message clearly indicating that you're trying to get a field that doesn't exist.
Actual results
Getting a can't read type from undefined error.
Additional context
Possible Solution