Questions tagged [apollo]

Apollo is a GraphQL client and cache for JavaScript, iOS (Swift) and Android.

Apollo is a flexible, fully-featured client for every platform.

Apollo is made up of a family of technologies you can incrementally add to your stack: Apollo Client to connect data to your UI, Apollo Engine for infrastructure and tooling, and Apollo Server to translate your REST API and backends into a GraphQL schema.

It has implementations for JavaScript, iOS and Android. The JavaScript client has integrations for React, Angular, Vue.js, Ember.js and more.

Apollo is fully compatible with any server that implements the GraphQL specification.

4536 questions
10
votes
2 answers

Apollo / GraphQl - Type must be Input type

Reaching to you all as I am in the learning process and integration of Apollo and graphQL into one of my projects. So far it goes ok but now I am trying to have some mutations and I am struggling with the Input type and Query type. I feel like it's…
Ivo
  • 2,308
  • 1
  • 13
  • 28
10
votes
2 answers

Dealing with ag grid react and rendering a grid of checkboxes

I'm messing with ag-grid, react-apollo, and everything seems to be working fine. The goal here is to click a check box and have a mutation / network request occur modifying some data. The issue i'm having is that it redraws the entire row which can…
Karan
  • 1,141
  • 2
  • 19
  • 42
10
votes
1 answer

How to handle httpOnly cookie authentication in next.js with apollo client

In my usual experience all single page apps I worked on used JWT as authentication mechanism. I came across api that uses httpOnly cookies for this. Since we can't access such cookie via javascript to know if it is present or not, how does one…
Ilja
  • 44,142
  • 92
  • 275
  • 498
10
votes
1 answer

GraphQL: how can I throw a warning after a successful mutation?

Let's imagine I have a createPost mutation that inserts a new post. In a typical app, that mutation can either: Succeed, returning a Post. Fail, throwing an error (I use apollo-errors to handle this). What I'd like to implement is a middle…
Sacha
  • 1,987
  • 1
  • 24
  • 41
10
votes
5 answers

Apollo client query error: "Network error: Failed to fetch" How to troubleshoot?

An Apollo server is setup, and it responds correctly to the query when using graphiql. An existing react-redux app with server side rendering needs to start using graphql and make this query. A component of this app has been setup to do the same…
Johnny5
  • 463
  • 2
  • 5
  • 16
10
votes
1 answer

Organization structure for fragment composition in large react-apollo apps

I'm using Apollo Client and React and I'm looking for a strategy to keep my component and component data requirements colocated in such a way that it can be accessible to parent/sibling/child components that might need it for queries and mutations.…
Donovan Hiland
  • 1,439
  • 11
  • 18
10
votes
2 answers

React, Apollo 2, GraphQL, Authentication. How to re-render component after login

I have this code: https://codesandbox.io/s/507w9qxrrl I don't understand: 1) How to re-render() Menu component after: this.props.client.query({ query: CURRENT_USER_QUERY, fetchPolicy: "network-only" }); If I login() I expect my Menu component…
user4412054
10
votes
4 answers

react-apollo gql, TypeError: Object(...) is not a function

I have a App component that I am wrapping into a apollo provider: import React, { Component } from "react"; import { observer, Provider } from "mobx-react"; import { BrowserRouter as Router } from "react-router-dom"; import styled from…
Miha Šušteršič
  • 9,742
  • 25
  • 92
  • 163
10
votes
1 answer

Emit deprecation warnings with Apollo client

Background We are working on a fairly large Apollo project. A very simplified version of our api looks like this: type Operation { foo: String activity: Activity } type Activity { bar: String # Lots of fields here ... } We've…
worldsayshi
  • 1,788
  • 15
  • 31
10
votes
3 answers

How to use a mocked data with react-apollo for tests

I'm using react-apollo to build a client that consumes a GraphQL API, however, I'm very stuck on testing. What I want is to mock the server so I can easily test the application without needing to make network calls. I've found some pointers on how…
Carlos Martinez
  • 4,350
  • 5
  • 32
  • 62
10
votes
3 answers

Apollo / Graphcool Subscriptions - WebSocket is closed before the connection is established

I'm trying to set up a graphcool subscription / websockets as per this tutorial at How To GraphQL but I'm getting the following message: WebSocket connection to 'wss://subscriptions.graph.cool/v1/###' failed: WebSocket is closed before the…
Ryan King
  • 3,538
  • 12
  • 48
  • 72
10
votes
2 answers

Apollo (GraphQL) fetch more than one element in a query

Can I fetch more than one element in a GraphQL query? I have many products list data and I want to fetch, for example, three products in my component. I have an array of needed product IDs, can I pass it to query? This is my query for one…
Alan Wołejko
  • 442
  • 2
  • 5
  • 20
10
votes
1 answer

How to handle Errors with the Apollo stack

I'm using the Apollo Stack with graphql-server-express and apollo-client. Because my backend is not perfect errors can appear and therefore I have to respond to a request with an error for that path. Till now my main problem was authentication and…
Kordon
  • 254
  • 2
  • 12
10
votes
1 answer

Max MQTT connections

I have a need to create a server farm that can handle 5+ million connections, 5+ million topics (one per client), process 300k messages/sec. I tried to see what various message brokers were capable so I am currently using two RHEL EC2 instances…
redboy
  • 599
  • 1
  • 8
  • 18
9
votes
1 answer

Inter-service communication between Apollo Federation subgraphs

Let's say we have S1, S2 subgraphs, and G gateway. S1 subgraph service needs some data from the S2 service. How should it be handled through the gateway and schema level? Should we use gateway in this kind of communication? Should we have a…