Hello! I'm currently getting an error when trying ...
# troubleshoot
f
Hello! I'm currently getting an error when trying to generate a react hook for a new mutation I'm adding. I've only added to entity.graphql and mutations.graphql, and the error I'm getting upon running
yarn generate
from datahub-web-react reads:
Found 2 errors
✖ src/types.generated.ts
AggregateError:
GraphQLDocumentError: Cannot query field "addSurveyResponse" on type "Mutation".
at /Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/src/graphql/mutations.graphql:38:5
at new AggregateError (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@ardatan/aggregate-error/index.cjs.js:141:24)
at Object.checkValidationErrors (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/core/node_modules/@graphql-tools/utils/index.cjs
.js:517:15)
at Object.codegen (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/core/index.cjs.js:102:15)
AggregateError:
GraphQLDocumentError: Cannot query field "addSurveyResponse" on type "Mutation".
at /Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/src/graphql/mutations.graphql:38:5
at new AggregateError (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@ardatan/aggregate-error/index.cjs.js:141:24)
at Object.checkValidationErrors (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/core/node_modules/@graphql-tools/utils/index.cjs
.js:517:15)
at Object.codegen (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/core/index.cjs.js:102:15)
✖ src/
File /Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/src/graphql/mutations.graphql caused error:
Unable to find field "addSurveyResponse" on type "Mutation"!
Error: Unable to validate GraphQL document!
at documents.map.documentFile (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/near-operation-file-preset/index.cjs.js:204:19)
at Array.map (<anonymous>)
at resolveDocumentImports (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/near-operation-file-preset/index.cjs.js:180:22)
at Object.buildGeneratesSection (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/near-operation-file-preset/index.cjs.js:232:25)
at Listr.task.wrapTask (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/cli/bin.js:913:64)
Error: Unable to validate GraphQL document!
at documents.map.documentFile (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/near-operation-file-preset/index.cjs.js:204:19)
at Array.map (<anonymous>)
at resolveDocumentImports (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/near-operation-file-preset/index.cjs.js:180:22)
at Object.buildGeneratesSection (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/near-operation-file-preset/index.cjs.js:232:25)
at Listr.task.wrapTask (/Users/melindacardenas/Documents/GitHub/datahub/datahub-web-react/node_modules/@graphql-codegen/cli/bin.js:913:64)
Would appreciate any help at all, thank you!
s
Can you share the changes you've made to those two files @fresh-carpet-31048? I'm not an expert on the React front end bits of DataHub, but willing to try to help. 🙂 If I can replicate your changes and test locally maybe we can debug until we find out what's up.
🙏 1
f
for mutations.graphql :
mutation addSurveyResponse($input: AddSurveyResponseInput!) {
addSurveyResponse(input: $input)
}
entity.graphql :
"""
Input provided when adding the association between a Metadata Entity and a survey response
"""
input AddSurveyResponseInput {
"""
The time at which the survey response information was submitted
"""
createdAt: Long
"""
The responses given to survey questions
"""
responseText: OwnerEntityType!
"""
The questions asked to users
"""
questionText: String,
"""
The primary key of the User to add or remove
"""
userUrn: String!
}
Thank you for being willing to help!!
s
My pleasure. I just had a clean clone, so now I'm running yarn install and all that fun stuff before I play around and see if I can first get the same error as you, then try to debug from there.
👍 1
b
@fresh-carpet-31048 Can you make sure that you've changed the top-level Mutation object to include the new mutation (addSurveyResponse)
It is also located inside entity.graphql
f
@big-carpet-38439 that worked!! Thank you ^_^
1
s
I'll mark that down in my TIL repo for myself. 😄
l
Thanks for helping out, @some-glass-26087 🌮
1
s
Oh well I didn’t do much but hey hopefully I can next time if same issue comes up. But thanks! All props to @big-carpet-38439 🌮
🙌 1
f
@big-carpet-38439 @some-glass-26087 more tacos for y'all, thank you!! 🌮
🙌 1
b
tacos are my favorite food
s
tacos