【发布时间】:2021-02-13 05:37:56
【问题描述】:
我正在使用 Apollo GraphQL,但我是新手,我收到以下错误:
{
"framesToPop": 1,
"name": "Invariant Violation"
}
这是我的代码:
const httpLink = createHttpLink({
uri: "https://api.example.com/v3/ListingsQuery",
fetch
});
const automaticPersistedQueryLink = createPersistedQueryLink();
const apolloClient = new ApolloClient({
link: ApolloLink.from([automaticPersistedQueryLink, httpLink]),
cache: new InMemoryCache()
});
const variables = {
filters: {statuses: ["ACTIVE", "UNLISTED"]},
orderBys: [{sortField: "STATUS", sortOrder: "DESC"}],
shouldFetchHostMultiListingAgendaPermissions: true,
offset: 0,
shouldFetchListingPermissions: false,
count: 15,
query: null
};
await apolloClient.query({
query: {},
variables
});
知道我做错了什么吗?
【问题讨论】:
-
“Invariant Violation”消息后没有数字?对此不确定(我本人对 Apollo 比较陌生),但我认为自 Apollo Client 3.1.0 以来,在 Invariant Violation 消息之后应该总是有一个数字。您是否有可能使用的是旧版本的库?
标签: apollo