Skip to content

Commit

Permalink
Make sure 'ctx.node' is defined for the V4 adaptor
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Mar 9, 2023
1 parent c2bb20b commit 516cf0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions @app/lib/src/GraphileApolloLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
Operation,
} from "@apollo/client";
import { Request, Response } from "express";
import { getOperationAST } from "graphql";
import { execute, hookArgs, isAsyncIterable } from "grafast";
import type { PostGraphileInstance } from "postgraphile";
import type {} from "grafserv/express/v4";
import { getOperationAST } from "graphql";
import type { PostGraphileInstance } from "postgraphile";

export interface GraphileApolloLinkInterface {
/** The request object. */
Expand Down Expand Up @@ -62,6 +62,10 @@ export class GraphileApolloLink extends ApolloLink {
await hookArgs(
args,
{
node: {
req,
res,
},
expressv4: {
req,
res,
Expand Down
6 changes: 5 additions & 1 deletion @app/server/__tests__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ export const runGraphQLQuery = async function runGraphQLQuery(
},
variableValues: variables,
};
await hookArgs(args, { node: { req, res } }, resolvedPreset);
await hookArgs(
args,
{ node: { req, res }, expressv4: { req, res } },
resolvedPreset
);

// Because we're connected as the database owner, we should manually switch to
// the authenticator role
Expand Down

0 comments on commit 516cf0c

Please sign in to comment.