Custom mutation throws: "Cannot read property 'args' of undefined"
See original GitHub issueDescribe the bug Custom mutation throws the following error.
TypeError: Cannot read property 'args' of undefined
[run:server] at ValidateCustomFieldsInterceptor.getArgumentMap (/app/node_modules/@vendure/core/src/api/middleware/validate-custom-fields-interceptor.ts:133:45)
[run:server] at ValidateCustomFieldsInterceptor.intercept (/app/node_modules/@vendure/core/src/api/middleware/validate-custom-fields-interceptor.ts:50:45)
[run:server] at /app/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:23:36
[run:server] at Object.handle (/app/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:21:56)
[run:server] at IdInterceptor.intercept (/app/node_modules/@vendure/core/src/api/middleware/id-interceptor.ts:38:21)
[run:server] at /app/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:23:36
[run:server] at InterceptorsConsumer.intercept (/app/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:25:24)
[run:server] at target (/app/node_modules/@nestjs/core/helpers/external-context-creator.js:76:60)
[run:server] at processTicksAndRejections (internal/process/task_queues.js:95:5)
[run:server] at /app/node_modules/@nestjs/core/helpers/external-proxy.js:9:24
To Reproduce Steps to reproduce the behavior:
Define custom API extension (shop api)
extend type Mutation {
doSomething: ActiveOrderResult!
}
- Invoke this mutation in production
(
shopApiDebug: false
in vendure config - doesnt seem to be happening locally when developing) - See error
Expected behavior No error. Seems this started with migration to Vendure 1.2.0 (worked before)
Environment (please complete the following information):
- @vendure/core version: 1.2.1
- Nodejs version: 14.17
- Database (mysql/postgres etc): postgres
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Getting Cannot read property 'args' of undefined when trying ...
I've got a schemaRetriever service that retrieves the schemas from 3 GraphQL Api's. For now I'm trying to get 1 stitch working so...
Read more >Cannot read property 'errors' of undefined in mutations - Help
Hey, community! I updated packages(apollo/client, react-scripts, typescript, etc) to the latest versions in my project and got errors in ...
Read more >Prisma throws an error "TypeError: cannot read property ...
I wanted to make a chat app to practice working with graphql and node, for database I used prisma. I was doing everything...
Read more >Null and undefined (Reference) - Prisma
Use case: null and undefined in a GraphQL resolver. In the following example mutation that updates a user, both authorEmail and name accept...
Read more >3. Adding mutations to your API - GraphQL Nexus
Writing GraphQL mutations; Exposing GraphQL objects for mutation operations ... + throw new Error('Could not find draft with id ' + args.draftId).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@michaelbromley I think I finally understood what is causing this. Its the proxy GraphQL which I am using (which is stitching two schemas together to create a single API- using
@graphql-tools/stitch
) a__typename
everywhere.Why it appeared now? I updated to the latest
@graphql-tools
version. Why I thought it appears randomly? I was testing it sometimes on the website, sometimes directly against the endpoint.The solution could be to add check in the
for
loop, together withselection.kind === 'Field'
to filter__typename
out.Should I submit a PR for this?
PS: sorry for spamming this thread - wanted to share the progress
I did some changes to my GraphQL schema - so its probably connected to that rather than the version bump. I will try to debug it further and let you know here.