首页 > 解决方案 > GraphQL 错误:在 SimplSchema 上将循环结构转换为 JSON

问题描述

每当一个变量不符合简单模式中的验证标准时,这个错误就会在发出请求时从后端出现在前端,我无法弄清楚为什么会发生这种情况。为什么我没有得到导致此错误的变量。

Error: GraphQL error: Converting circular structure to JSON
--> starting at object with constructor 'ValidationContext'
|     property '_simpleSchema' -> object with constructor 'SimpleSchema'
|     property '_validationContexts' -> object with constructor 'Object'
--- property 'default' closes the circle
at new ApolloError (ApolloError.ts:46)
at Object.next (QueryManager.ts:225)
at notifySubscription (Observable.js:135)
at onNotify (Observable.js:179)
at SubscriptionObserver.next (Observable.js:235)
at observables.ts:12
at Set.forEach (<anonymous>)
at Object.next (observables.ts:12)
at notifySubscription (Observable.js:135)
at onNotify (Observable.js:179)
at SubscriptionObserver.next (Observable.js:235)
at index.js:147

标签: reactjsmongodbgraphqlnext.jsapollo

解决方案


推荐阅读