草庐IT

javascript - 带有 Lambda 的 Graphql Yaga Playground - "Server cannot be reached"

我正在使用servlerless/lambda设置graphql端点,并且在尝试连接到graphql-yoga附带的graphqlplayground时收到错误。当我去到有Playground(/playground)的路线时,它会启动Playground界面,但它只是说:Servercannotbereached在Playground的右上角。值得注意的是,我正在使用makeRemoteExecutableSchema实用程序来代理到另一个graphql端点(这是我的名为Prismic的CMS)。我不认为这是问题所在,因为在普通的快速服务器上进行测试时,我已经成功地将它连接到Play

javascript - Next js 和 Apollo - Cookie 未被传递

我将NextJS与Apollo一起使用,并在我的数据HOC中使用以下配置对其进行了设置:import{ApolloClient}from'apollo-client';import{InMemoryCache}from'apollo-cache-inmemory';import{HttpLink}from'apollo-link-http';import{onError}from'apollo-link-error';import{withClientState}from'apollo-link-state';import{getMainDefinition}from'apollo-u

javascript - Apollo 订阅 - 处理 WS 与 subscribeToMore 断开连接

我一直在寻找一种方法来处理我的带有Apollo订阅的React应用程序中的网络套接字断开连接,但还没有找到这样做的方法。我在apollo文档中看到的其他示例显示了以下捕获重新连接的方法:constwsClient=process.browser?newSubscriptionClient(WSendpoint,{reconnect:true,}):null;constwsLink=process.browser?newWebSocketLink(wsClient):null;if(process.browser){wsLink.subscriptionClient.on('reconn

javascript - GraphQL:从兄弟解析器访问另一个解析器/字段输出

需要一些帮助。假设我请求以下数据:{parent{obj1{value1}obj2{value2}}}我需要value1解析器中value2的结果进行计算。想在value2中返回一个promise并以某种方式将其带入value1解析器,但如果value2解析器尚未运行怎么办?有什么办法可以做到吗? 最佳答案 我的直接想法是,您可以使用上下文来实现类似的目的。我想您可以将类似对象的缓存与事件发射器混合来解决竞争条件问题。例如,假设我们有一些类(class)classCacheEmitterextendsEventEmitter{con

javascript - Apollo "Subscription field must return Async Iterable. Received: undefined"

我有一个触发channel事件“countIncr”的突变,但我没有看到事件的相应订阅与事件负载一起触发。更新:我已经对这篇文章进行了多次更新,现在我正在更改标题以更能代表我所在的位置。我收到graphqlPlayground错误"SubscriptionfieldmustreturnAsyncIterable.Received:undefined"我遇到问题的TGRstack复制:https://github.com/TGRstack/tgr-apollo-subscription-example-microservice/没有TGRstack的工作再现:https://github

javascript - 如何将 apollo-link-http 与 apollo-upload-client 一起使用?

我正在尝试弄清楚如何使用apollo-link-http与apollo-upload-client.两者都创建了一个终止链接,但我怎么能同时使用这两个链接呢?在我的index.js中我有这样的,但它不会工作,因为两个链接都终止=>constuploadLink=createUploadLink({uri:process.env.REACT_APP_GRAPHQL_URL});consthttpLink=newHttpLink({uri:process.env.REACT_APP_GRAPHQL_URL});constclient=newApolloClient({link:Apollo

javascript - GraphQL 联合和冲突类型

我的项目有问题,但我在互联网上找不到任何解决方案。情况是这样的。我有一个Union(DataResult),有两种类型(Teaser和Program)我有一个带有data字段的Zone类型(数组DataResult)Teaser和Program具有相同的title字段,但类型不同(StringvsString!)这是来自Zone、Teaser和Program模式的部分:typeProgram{title:String}typeTeaser{title:String!}unionDataResult=Teaser|ProgramtypeZone{(...)data:[DataResult

javascript - 具有 React 的 Apollo 客户端 2 无法进行查询

我对带有React的Apollo客户端版本2有疑问。(https://www.apollographql.com/docs/react/)当我根据文档设置Apollo客户端时,我无法在GraphQl服务器上进行查询,它会引发错误:Uncaught(inpromise)TypeError:_super.callisnotafunctionatnewObservableQuery(ObservableQuery.js:36)atQueryManager.watchQuery(QueryManager.js:393)atQueryManager.js:420atnewPromise()atQ

javascript - 将变量从输入传递到 GraphQL 搜索调用

我正在学习graphql和react-apollo。我在我的代码中设置了一个搜索查询。我不确定如何将变量从我的代码(即this.state.search)传递到我的grapnql调用。我看了很多答案,包括thisone,但似乎有点不同。Thedocsalsodon'tseem就如何使用状态作为变量提供任何指导。我的代码如下。谁能建议如何将这两者联系起来?importReact,{Component}from'react'import{graphql}from'react-apollo'importgqlfrom'graphql-tag'classSearchextendsCompone

javascript - 在 meteor 中使用 spacejam 时出现 "fetch is not found globally and no fetcher passed"

我正在编写单元测试来检查我的api。在我将我的gittest分支与我的dev分支合并之前,一切都很好,但后来我开始遇到这个错误:Apprunningat:http://localhost:4096/spacejam:meteorisreadyspacejam:spawningphantomjsphantomjs:Runningtestsathttp://localhost:4096/localusingtest-in-consolephantomjs:Error:fetchisnotfoundgloballyandnofetcherpassed,tofixpassafetchforyo