📡 GraphQL and gRPC — interview questions

12 questions. Filter by what the role asks for; open one for the six layers of the answer. The course is where the answers come from.

12 of 12

01A frontend team says a field, `order.customer.name`, sometimes comes back `null` even though the customer definitely exists and `name` is declared `String!` in the schema. `String!` is supposed to mean "never null" — so what's actually happening?GraphQL fundamentalseasy0-2y02A query asks for twenty orders and each order's `customer`. The `customer` resolver has a single `findById` call in it — no loop, nothing obviously wrong. Why does this still hit the database twenty times, and whose "fault" is that, the resolver or the query?Resolver performancemedium3-5y03Walk through what actually changes when a resolver moves from `@SchemaMapping` (per-object) to `@BatchMapping` (per-level). Does the engine call the new method less often in the same way it would call a cached method less often?DataLoadermedium3-5y04A teammate adds a `DataLoader` in front of an existing per-object resolver and reports the N+1 is fixed because "DataLoader caches now." Their dashboard still shows one query per customer at runtime. What did they actually fix, and what didn't they?DataLoadersenior8+y05A GraphQL API's uptime dashboard, built on HTTP status codes, reports 100% success for an hour during which half of all queries were actually failing. How is that possible, and what should the dashboard have measured instead?Errors and observabilitymedium3-5y06A GraphQL API has a depth limit of ten levels in production. An attacker sends `orders(first: 1000000) { id }` — one field, one level deep. Does the depth limit stop it, and if not, what does?Query limitshard5-8y07A `cancelOrder` mutation is designed to return `Order!` directly. A teammate wants to change it to return a `CancelOrderPayload` type with an `order` and an `error` field instead. Why is that a better design, and what does it actually fix?Schema designeasy0-2y08A gRPC call sets a client-side timeout of 2 seconds and calls three downstream services in sequence. Two seconds after the call starts, the first downstream call is still in progress. What happens, and how is this different from each service independently having its own 2-second timeout?gRPC reliabilitymedium3-5y09A gRPC service needs to signal 'the requested order doesn't exist' and 'you don't have permission to view this order' to its caller. What mechanism carries that, and how would you decide which status code to use for each?gRPC errorsmedium3-5y10Why is renaming a protobuf field's Java-facing name always safe, while renumbering it — keeping the name, changing the field number — silently corrupts already-stored or already-in-flight data? What's actually on the wire?Protobuf wire formathard5-8y11gRPC documentation says one HTTP/2 connection can carry many concurrent calls, streaming and unary alike. What actually makes that true at the protocol level, and where does it stop being true?gRPC transportsenior8+y12A teammate coming from an older protobuf version asks why `required` doesn't exist in proto3, and proposes simulating it with a comment convention (`// REQUIRED`) plus a check in every handler. Is that a reasonable substitute, and what was actually wrong with `required` in the first place?Protobuf compatibilityhard5-8y