diff --git a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js index 09aeb7902bf46..1c5bbd048e24b 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js @@ -163,7 +163,7 @@ const runQueriesForPathnames = pathnames => { return new Promise(resolve => { const onDrain = () => { - queue.off(`drain`, onDrain) + queue.removeListener(`drain`, onDrain) resolve() } queue.on(`drain`, onDrain)