Questions tagged [apollo-server]
Apollo Server is a GraphQL server for Express, Connect, Hapi and Koa, written in TypeScript
1,983
questions
0
votes
0
answers
5
views
apollo graphql federation server, load balancer health checks fail
I have a project which contains 6 graphql subgraphs and one gateway (express server) that federates those and connects to those. I have deployed this project on aws, each of those servers represents ...
0
votes
1
answer
20
views
Next.js / graphql / apollo-server-micro => API resolved without sending a response for /api/graphql, this may result in stalled request
I am trying to start a project with next.js, graphql and apollo-server-micro.
But I got an error when I am running localhost:3000/api/graphql and I don't know how to solve it.
Playground is launching ...
0
votes
0
answers
12
views
Authentication Error with Apollo-server, Prisma and JWT
I am trying to get a backend authentication workflow for Registering a new User. This is the error, that I am recieving when I run the Apollo-Client.
//create a new User/Register User
@Mutation((...
0
votes
1
answer
22
views
Query GraphQL with multiple types
I'm trying to make a GraphQL query, out of the ordinary, but so far I haven't found anything related.
I would like to leave the where parameter with two optional types, see the example. Is this ...
0
votes
0
answers
35
views
Resolve one to many relation Nest.js / GraphQL Federation with Mercurius
I am using Nest.js / GraphQL Federation with Mercurius. I have two entities Products and Store that reside in different apps. The store should have multiple products as one to many relationship. I ...
0
votes
0
answers
22
views
Cannot query field \"xxx\" on type \"Query\".",
I have a GraphQL server built with apollo-server and i am getting this error. The query works correctly on apollo graphql studio, but I get the error when I try fetching the data in my React ...
1
vote
0
answers
12
views
Netlify Functions logs doesnt show up when there are no uncaught exceptions? How to make sure Netlify function logs are captured consistently
I was deploying an application using Netlify Function. While doing so I was trying to access logs and surprisingly I was able to see logs only when there is an Uncaught Exception.
In Other cases, the ...
0
votes
0
answers
16
views
Using GraphQL and Apollo Server but when I run npm start the server crashes
I've 2 files: schema.js and index.js in my server file.
I can't get my server to run and I'm not sure why.
index.js
server.js
terminal error
0
votes
0
answers
16
views
ApolloServer GraphQL Testing
Following the documentation here: https://www.apollographql.com/docs/apollo-server/testing/testing/ (literally, just copying and pasting and then fixing the typescript errors), I have this code in ...
0
votes
0
answers
12
views
Graphql apollo playground - how to add array of strings
tldr: How do I write a mutation in GraphQL playground to add an array of strings when creating a new record in the database
I'm using a MongoDB database for an application. I always have trouble ...
0
votes
0
answers
13
views
Apollo Server spamming my console with requests?
On my Apollo Server, I added
const server = new ApolloServer({
typeDefs,
resolvers,
context: async ({ req }) => {
console.log(req.headers.authorization)
},
});
because I want to later ...
0
votes
0
answers
19
views
How to run subscriptions with apollo-server-express and neo4j?
I was trying to run subscriptions on my server, but got an error
"error": "Could not connect to websocket endpoint ws://localhost:3000/graphql. Please check if the endpoint url is ...
-1
votes
1
answer
62
views
Cannot return null for non-nullable field in a GraphQL query
const { ApolloServer, gql } = require('apollo-server-express');
const express = require('express');
// dummy data
const books = [
{ id: 1, title: 'book1', author: 'author1' },
{ id: 2, title: '...
0
votes
1
answer
17
views
Is it possible to check the id exists from one service to another in apollo-server with graphql?
I am stuck in the following problem, has anyone faced the same?
I have got two services using apollo-server with graphql using mongodb:
Group service
User service
Group service contains “users” ...
0
votes
0
answers
16
views
ApolloServer Wrong response value {key: value} !== /"{key: value}"/
I have simple __resolveType with returns given object
const Resolvers = {
Foo: {
__resolveType(obj: Objct) {
console.log(typeof obj) // Object
return obj
},
},
Query: {
...
1
vote
1
answer
30
views
Alternative to saving JWT token in local storage?
What is the secure standard for saving authorization/authentication with GraphQL/Apollo Client and Server.
Currently in both the course I am taking and the Apollo docs, they are of saving a JWT token ...
1
vote
1
answer
25
views
Query an interface that implements another interface in GraphQL
I'm currently working on an Activity Feed built using GraphQL Nexus and Apollo Server (3.9.0). It will receive a flurry of information that will have shared fields that are handled by a shared ...
1
vote
0
answers
31
views
What port should I run a GraphQL server on?
Ports 80 and 443 are in use.
Port 3000 seems to be the default for Apollo Server, but I've examples with people using 4000-5000.
Is there any typical port people are using?
1
vote
0
answers
55
views
Is there a way to do pagination on a child field of a GraphQL type?
I am working on adding a pagination functionality for the server side of a GraphQL API. For context, I include a sample of the UML diagram of the Products table and its referenced tables from the ...
0
votes
0
answers
11
views
apollo-server-express v3: middleware to keep a log of all errors and requests
i want to keep a log of all incoming requests and all possible errors using Winston.
i know i can add a logger to each resolver and an error logger to try catches.
is there a way to globally do this ...
-1
votes
0
answers
12
views
Apollo Server multi-tenant account separation
I have an Apollo Server on Express, and I am using mongoose + graphql-compose-mongoose to generate my GraphQL schema from my mongoose models.
This all works great, but I'm reaching the point where I ...
2
votes
0
answers
32
views
How does Apollo paginated "read" and "merge" work?
I was reading through the docs to learn pagination approaches for Apollo. This is the simple example where they explain the paginated read function:
https://www.apollographql.com/docs/react/pagination/...
0
votes
1
answer
40
views
apollo graphql server subscription - send only if data differs
So I created a subscription in apollo server.
i have my data for that request coming from multiple classes, nested in each other, and this works just fine.
But if I would like apollo to only send out ...
0
votes
0
answers
35
views
Can I add a Dynamic Field in GraphQL query?
My static data is like below,
// books.json
[
{
"id": 1,
"name": "Gullivers Travels"
},
{
"id": 2,
"name": "Lowland"
...
1
vote
1
answer
27
views
Cookies was not sent when the request come from front-end
I am following Ben Awad full stack tutorial with same stack (
React
TypeScript
GraphQL
URQL/Apollo
Node.js
PostgreSQL
MikroORM/TypeORM
Redis
Next.js
TypeGraphQL
Chakra
)
But newer versions (the video ...
0
votes
0
answers
20
views
refreshToken using cookies in graphql
I am new to refreshToken and also new to cookies.
I am using graphql and I am trying to store refreshToken on cookies when user is logging in.
The problem is nothing happned in my cookies when I am ...
0
votes
0
answers
20
views
SSL failure when connecting from quarkus smallrye-graphql-client to apollo-server
I'm currently struggeling with https connection from quarkus using the smallrye-graphql-client to an apollo-server. I have created self-signed-certificates and used them for the apollo-server. When ...
0
votes
0
answers
9
views
How does the backend return several of the union types on demand
The front-end uses the union type to request on-demand, and how does the back-end fetch data from the database on demand?
2
votes
0
answers
54
views
Handle unsubscribe GraphQL subscription
I have an issue with subscription can't be unsubscribe.
Before we start, this is my setup: Apollo Client(graphql-ws) <-> Apollo Server(graphql-ws). On the server, I build a custom PubSub instead ...
0
votes
0
answers
12
views
Dockerize an Apollo Server Lambda to server Graph Ql query
I am trying to set up a Lambda RIE (Run Lambda locally inside a Docker container).
This Lambda basically contains and Apollo server.
I am trying to create a Graph Ql based server inside a Lambda and ...
1
vote
0
answers
18
views
Image issue while rendering custom landing page via Apollo Server
I am using apollo server, graphql, mongoDB in my nodeJS project. My project structure is like this:-
|
|
|-- app.js
|-- public
| |
| images
| |
| |-- api-screen.jpg
|
|-- config
|-- app
...
1
vote
0
answers
29
views
If I change Apollo cache, Is this change reflected without refresh?
I use apollo server and graphql.
I move from screen A to screen B.
And in screen B, I change data of screen A.
So in order to reflect this change, I change cache of that data.
And I navigate.goBack() ...
2
votes
1
answer
68
views
Google Pubsub Error 16: Unauthenticated: Failed to retrieve auth metadata occurs when server running for a long time
I have this strange issue that keeps occurring with my google pub sub service. When I start my server, the google pub sub service works and there doesn't seem to be an issue. When I leave my server ...
3
votes
0
answers
41
views
Can I restrict a mutation to update an object based on the object itself?
I have the following objects in my database:
[
{
"id": 1,
"name": "foo",
"objType": "A"
},
{
"id"...
1
vote
1
answer
22
views
apolloGateway cannot connect to graphql express service
I ran a service using apolloGateway:
export const server = async () => {
const app = express();
const services = [ { name: "product-service", url: "http://localhost:4001/graphql&...
0
votes
1
answer
34
views
Cannot query page details from frontend
I'm trying to build an app with all dynamic pages so they can be updated by the logged in admin. In the db (mongoDB) I have a pages collection with _id, pageTitle, and content. So far I just have ...
0
votes
0
answers
21
views
Couldn't start a graphQL server
Code:
const { ApolloServer, gql } = require("apollo-server-express");
const typeDefs = gql`
type Query {
hello: String
}
`;
const resolvers = {
Query: {
hello: () => {
...
0
votes
0
answers
26
views
Cors Option not constant
I'm having problem with CORS.
My Node.js Server with apollo-server-express(version 3.7)
My problem is CORS is not constant.
My React Project request api server and works well.
But sometimes api server ...
1
vote
0
answers
32
views
Apollo federation entity union / extending entities in same subgraph
I am currently sucessfully being able to extend types across services.
Service A:
type User @key(fields: "id") {
id: ID!
}
Service B:
extend type User @key(fields: "id") {
id: ...
1
vote
0
answers
76
views
Adding subscription to graphQL 'createPost' function
I'm trying to add a subscription for following create post function
inside main index.js I have imported PubSub like following
const { ApolloServer } = require ('apollo-server');
const mongoose = ...
1
vote
1
answer
23
views
Using 2 sets of typedefs in Apollo
I'm using ApolloServer on my Node env to run a server:
// App.js
const express = require('express');
const { ApolloServer } = require('apollo-server-express');
const resolvers = require('./resolvers....
1
vote
0
answers
31
views
Can we regenerate subgraph from the supergraph in GraphQL/Apollo Federation?
I need to know Is that possible or not.
For example we have 3 api and each have their subgraph and we have implemented federation.
By Using federation we have created Single Truth of Source that is ...
2
votes
0
answers
42
views
User login best practices in React JS and Apollo
I have multiple questions about user login logic.
I'm using React JS with Apollo client for the front end, and I use Node JS with GraphQL and Apollo server for the back end.
And that's how I handle ...
0
votes
1
answer
19
views
How to add "directiveResolvers" to apollo-server-express middleware?
I'm working on transitioning from apollo-server to apollo-server-express, so that I can implement Stripe webhooks.
Previously with apollo-server, I was able to add directiveResolvers to the schema, so ...
0
votes
1
answer
82
views
Nestje subscription getting NULL and with the error: "Cannot return null for non-nullable field Subscription"
This is a simple test for Subscription in my nestjs project with graphql, but I got the error: Cannot return null for non-nullable field Subscription
Here is the code:
//* ~~~~~~~~~~~~~~~~~~~ ...
0
votes
0
answers
16
views
save is not a function while trying to update values [duplicate]
trying to update products size after purchasing and getting products.save is not a function.
I am getting the size from the products in the cart, and when you succeed purchasing that product my aim is ...
0
votes
1
answer
31
views
update products with the same id
I got products with the option to choose size,
So If I add 'X' product to the cart with sizes 4 and 5 it will add 2 items to the cart like this :
My goal is when you succeed buying that items from ...
1
vote
0
answers
22
views
Building Relations between ObjecTypes in Typgraphql and Prisma
I am trying to create a relation between 2 ObjecTypes in Typgraphql with Apollo. This is my error:
As you can see in my category section I get null. This should be an item, because I already see it ...
2
votes
0
answers
56
views
What is the default Apollo Client query cache TTL?
I use Apollo Client/Server through a React/Next app with in-memory cache enabled with the default cache strategy, I guess it's cache-first.
I'd like to know what is the default Apollo cache TTL? In ...
0
votes
1
answer
80
views
Does graphQL expose a method to validate an input provided by a client is in the schema
A client is sending inputs to our graphQL mutation that are not part of the schema because the inputs were removed. Eventually, they catch up and remove the inputs so they're not sending them anymore. ...