Skip to content

Commit

Permalink
fix(createServer): use addHook instead of ready (redwoodjs#9871)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jtoar committed Jan 22, 2024
1 parent fca8d7a commit 49347fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/api-server/src/plugins/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,16 @@ export async function redwoodFastifyGraphQLServer(
})
}

fastify.ready(() => {
fastify.addHook('onReady', (done) => {
console.info(`GraphQL Yoga Server endpoint at ${yoga.graphqlEndpoint}`)
console.info(
`GraphQL Yoga Server Health Check endpoint at ${yoga.graphqlEndpoint}/health`
)
console.info(
`GraphQL Yoga Server Readiness endpoint at ${yoga.graphqlEndpoint}/readiness`
)

done()
})

done()
Expand Down

0 comments on commit 49347fd

Please sign in to comment.