Skip to content

Commit 516cf0c

Browse files
committed
Make sure 'ctx.node' is defined for the V4 adaptor
1 parent c2bb20b commit 516cf0c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

@app/lib/src/GraphileApolloLink.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import {
66
Operation,
77
} from "@apollo/client";
88
import { Request, Response } from "express";
9-
import { getOperationAST } from "graphql";
109
import { execute, hookArgs, isAsyncIterable } from "grafast";
11-
import type { PostGraphileInstance } from "postgraphile";
1210
import type {} from "grafserv/express/v4";
11+
import { getOperationAST } from "graphql";
12+
import type { PostGraphileInstance } from "postgraphile";
1313

1414
export interface GraphileApolloLinkInterface {
1515
/** The request object. */
@@ -62,6 +62,10 @@ export class GraphileApolloLink extends ApolloLink {
6262
await hookArgs(
6363
args,
6464
{
65+
node: {
66+
req,
67+
res,
68+
},
6569
expressv4: {
6670
req,
6771
res,

@app/server/__tests__/helpers.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ export const runGraphQLQuery = async function runGraphQLQuery(
174174
},
175175
variableValues: variables,
176176
};
177-
await hookArgs(args, { node: { req, res } }, resolvedPreset);
177+
await hookArgs(
178+
args,
179+
{ node: { req, res }, expressv4: { req, res } },
180+
resolvedPreset
181+
);
178182

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

0 commit comments

Comments
 (0)