Skip to content

Commit 49347fd

Browse files
authored
fix(createServer): use addHook instead of ready (redwoodjs#9871)
Fixes the issue @Tobbe and I were seeing in studio: ``` ~/redwood-project/node_modules/avvio/boot.js:244 throw new AVV_ERR_ROOT_PLG_BOOTED() ^ AvvioError [Error]: Root plugin has already booted ... ``` `fastify.ready` actually starts the server. All this is doing is logging. We want to use `addHook` instead. Follow up to redwoodjs#9845.
1 parent fca8d7a commit 49347fd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/api-server/src/plugins/graphql.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,16 @@ export async function redwoodFastifyGraphQLServer(
115115
})
116116
}
117117

118-
fastify.ready(() => {
118+
fastify.addHook('onReady', (done) => {
119119
console.info(`GraphQL Yoga Server endpoint at ${yoga.graphqlEndpoint}`)
120120
console.info(
121121
`GraphQL Yoga Server Health Check endpoint at ${yoga.graphqlEndpoint}/health`
122122
)
123123
console.info(
124124
`GraphQL Yoga Server Readiness endpoint at ${yoga.graphqlEndpoint}/readiness`
125125
)
126+
127+
done()
126128
})
127129

128130
done()

0 commit comments

Comments
 (0)