小编Wil*_*ier的帖子

"this.getClient(...).watchQuery不是函数" - 使用Apollo 2/Next.js进行远程模式拼接

所以我试图在Next.js应用程序的客户端上拼接多个远程GraphCMS端点,在尝试/组合互联网上的每个示例之后,我已经把它带到了一个值得询问的地方.我的错误:

TypeError: this.getClient(...).watchQuery is not a function at GraphQL.createQuery

github repo在这里,你可以在上下文中看到这个initApollo.js:

import { ApolloClient } from 'apollo-client'
import {
  makeRemoteExecutableSchema,
  mergeSchemas,
  introspectSchema
} from 'graphql-tools'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import fetch from 'node-fetch'
import { Observable, ApolloLink } from 'apollo-link'
import { graphql, print } from 'graphql'
import { createApolloFetch } from 'apollo-fetch'

let apolloClient = null

if (!process.browser) {
  global.fetch = fetch
}

const PRIMARY_API = 'https://api.graphcms.com/simple/v1/cjfipt3m23x9i0190pgetwf8c'
const SECONDARY_API = …
Run Code Online (Sandbox Code Playgroud)

apollo reactjs graphql react-apollo next.js

8
推荐指数
1
解决办法
1014
查看次数

标签 统计

apollo ×1

graphql ×1

next.js ×1

react-apollo ×1

reactjs ×1