Tag: apollo
-
How to fix empty schema.gql file?
0 I want to connect my frontend with backend by apollo server. Schema is generated in backend main folder and i have following settings: app.module: GraphQLModule.forRoot<ApolloDriverConfig>({ driver: ApolloDriver, autoSchemaFile: "schema.gql", sortSchema: true, playground: false, }), main.ts: import { NestFactory } from ‘@nestjs/core’; import { GraphQLSchemaHost } from ‘@nestjs/graphql’; import { AppModule } from ‘./app.module’; import…
-
Using await useAsyncQuery() is returning null in the browser but shows the data value in terminal when console.log(data.value)
0 I’m using Nuxt 3 and fetching data from Strapi with Apollo and graphQL. I have used this similar setup with Prepr in the past with no issues. My GraphQL query is correct and it is returning data but the problem is in the timing. here’s the code I’m using in my page in Nuxt…
-
why polling of Apollo useQuery don’t call onCompleted?
1 I am playing around the code: https://codesandbox.io/s/restless-framework-uldf4q?file=/src/App.js import React, { Fragment } from "react"; import { gql } from "apollo-boost"; import { useQuery } from "@apollo/react-hooks"; const GET_DOG_PHOTO = gql` query Dog($breed: String!) { dog(breed: $breed) { id displayImage } } `; const breed = "dingo"; const App = () => { const [count,…
-
Strapi 4 and NuxtJS: Unable to connect via GraphQL (ECONNREFUSED)
2 I am building a small blog application using NuxtJS, Strapi 4 (and GraphQL) and apollo. To do that, i followed this tutorial: https://www.youtube.com/watch?v=yDkoV-8krcA The problem is for some reason NuxtJS is unable to connect to Strapi. I get the following error message: Network error: request to https://localhost:1337/graphql failed, reason: connect ECONNREFUSED ::1:1337 Strapi is…
-
GraphQL: Nested queries vs root queries
10 I’m using Apollo GraphQL on my server, and I’m trying to design my GraphQL API. One question I have is whether or not I should prefer nested queries over root queries. Let’s examine both in this example where the current user, me, has many invitations. Root queries me { id name } invitations {…
-
Mock UseMutation in react testing library and jest used in custom hook
0 I have created a custom hook which is having several functions for processing the data and calling the functions. I am writing the test cases for few specific scenarios inside the hook. I will mention in the code below only functions specific to my case. This is my custom hook : useShippingInformation.js const useShippingInformation…
-
Apollo-client returns “400 (Bad Request) Error” on sending mutation to server
13 I am currently using the vue-apollo package for Apollo client with VueJs stack with django and graphene-python for my GraphQl API. I have a simple setup with vue-apollo below: import Vue from ‘vue’ import { ApolloClient } from ‘apollo-client’ import { HttpLink } from ‘apollo-link-http’ import { InMemoryCache } from ‘apollo-cache-inmemory’ import VueApollo from…
-
Adding an entity to apollo-client cache after mutation to match query variables
0 I’m currently building a SPA with apollo-graphql and everything is working fine so far. However, I have reached a point where the apollo cache causes some issues. I have a UI which provides several filter criteria. The fields are mapped to variables in my graphql query, specifically a project ID and a timespan (start/end…
-
http-proxy-middleware and graphql
0 I have a simple graphql-server: const typeDefs = gql` type Message { id: ID! text: String! } type Query { getMessage: Message } `; const resolvers = { Query: { getMessage: () => { return { id: ‘1’, text: ‘Hello, World!’ }; } } }; async function startServer() { const server = new ApolloServer({…
-
graphql error: Cannot return null for non-nullable field when calling field in query
0 I am getting this error when I try to query my memberList resolver, It needs to return a membeTypeID but it is returning null – i am using Apollo for this if that helps at all: "errors": [ { "message": "Cannot return null for non-nullable field Member.memberType.", "locations": [ { "line": 5, "column": 3…