Questions

  • Generating graphql with pothos and prisma plugin returns null data even though data exists in the database

    0 I’m creating a graphql with nextjs using prisma, and pothos. I’ve defined the schema for my table: schema.prisma: model Course { id Int @id @unique @default(autoincrement()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt title String content String published Boolean courseId String cId String Lessons Lesson[] } I’ve added this as my resolver/graphql types: import { […]

  • `Cannot use e “__Schema” from another module or realm.` and `Duplicate “graphql” modules` using ApolloClient

    5 I have a React application with ApolloClient with Apollo-Link-Schema. The application works fine locally but in our staging environment (using GOCD), we get the following error: Uncaught Error: Cannot use e “__Schema” from another module or realm. Ensure that there is only one instance of “graphql” in the node_modules directory. If different versions of […]

  • How to hide django default filters from others except admin user?

    1 I have below User graphql API endpoint in my application. Query class Query(UserQuery, graphene.ObjectType): all_users = DjangoFilterConnectionField( UserType, filterset_class=UserFilter) Type class UserType(DjangoObjectType): class Meta: model = User fields = "__all__" interfaces = (graphene.relay.Node,) Filter class UserFilter(FilterSet): user_name_search = CharFilter( method=’user_name_filter’, label=’User Name Search’ ) class Meta: model = User fields = [ ‘user_name_search’, ‘user_id’, […]

  • Graphql Codegen’s client-preset-swc-plugin not working at all

    0 I couldn’t use Graphql Codegen’s client-preset-swc-plugin with Vite at all to reduce the bundle size. It panics when trying to build for production, I’m getting this error: [vite-plugin-pwa:build] failed to handle: failed to invoke plugin: failed to invoke plugin on ‘Some("/home/user/project/web/src/index.tsx")’ Caused by: 0: failed to invoke `/home/user/project/web/node_modules/@graphql-codegen/client-preset-swc-plugin/swc_plugin.wasm` as js transform plugin at /home/user/project/web/node_modules/@graphql-codegen/client-preset-swc-plugin/swc_plugin.wasm […]

  • Apollo GraphQL Server + TypeScript

    17 I’ve been working on a project lately, which has node.js + express + typescript + Apollo server stack. And while researching on Apollo client, I’ve stumbled upon TypeScript section. But nothing like that was for server, which leaves me to freedom of choice in this case. So the question is: are there any best […]

  • Microservice Communication for Graphql APIs

    1 Problem Statement : I have a GraphQl query defined which is responsible for fetching few details from the database. This graphql schema let’s say is defined in microservice-B . Now I want this garphql API to be called by an upstream microservice-A. microservice-A is actually the one which is actually called by our Clients(UI […]

  • C++20’s std::views::filter not filtering the view correctly

    7 I was writing a simple C++ program that generates a list of random integer values from a normal distribution, then takes first N generated items and filters them so that their absolute value is greater than 42. The code i wrote is the following: int main() { //convenience namespace rng = std::ranges; namespace view […]

  • How to make a query in Apollo Client properly?

    0 I’m new to Apollo Client and I want to test API endpoint to fetch the data. const client = new ApolloClient({ cache: new InMemoryCache(), link: new HttpLink({ uri: "https://api.thecatapi.com/v1/breeds", useGETForQueries: true }), }); client .query({ query: gql` { id name } `, }) .then((result) => console.log(result)) In data field I keep getting undefined. I […]

  • design APIs using HTTP methods

    0 I was was below question in Netskope system design interview recently i.e. design APIs for below functionalities (full URL path with HTTP method) and I could not answer well so I was rejected. I pasted my solution below. I could not find a solution using google search. Can you please provide some solution? 1. […]

  • What is the correct way to delete a post in within a graphql subscription?

    1 I’m working on a project where I have posts that are created and shown on a screen. I’ve done this using graphql subscriptions for real time updating of posts, but I need the user to also be able to delete their own posts and for that update to be shown in real time. The […]