Skip to content

Conversation

@Tobbe
Copy link
Member

@Tobbe Tobbe commented Jun 7, 2025

Huge shoutout to @ladderschool who originally created this PR over at the RedwoodGQL repo: redwoodjs/graphql#12046

V4 of Fastify is approaching end of life by 6/30/25. This PR seeks to upgrade the relevant packages.
Fastify V5 also requires node >=20 now.

Migration docs:
https://fastify.dev/docs/latest/Guides/Migration-Guide-V5/

Luckily many changes were already deprecated from V3->V4 and I have found no issues running V5 in my production app. The only breaking change is how Fastify handles the logger, which this PR addresses, specifically in the createServerHelpers.ts file.

// v5
const loggerInstance = require('pino')()
const fastify = require('fastify')({
  loggerInstance
})

There's a test repository that @ladderschool used to confirm these updates in this PR from:
https://github.com/ladderschool/fastify-v5-test

Local build succeeded: https://cloud.nx.app/runs/saVKz8Qhgn
Local tests succeeded: https://cloud.nx.app/runs/5SujFvDgYM

@Tobbe Tobbe added the release:breaking This PR is a breaking change label Jun 7, 2025
@Tobbe Tobbe added this to the next-release-major milestone Jun 7, 2025
@Tobbe Tobbe merged commit c8af633 into main Jun 7, 2025
46 checks passed
@Tobbe Tobbe deleted the tobbe-deps-fastify-v5-3-3 branch June 7, 2025 11:39
@Tobbe Tobbe changed the title feat(deps): Upgrade feat(deps): Upgrade to Fastify v5 Jun 7, 2025
Tobbe added a commit that referenced this pull request Jun 8, 2025
Huge shoutout to @ladderschool who originally created this PR over at
the RedwoodGQL repo: redwoodjs/graphql#12046

V4 of Fastify is approaching end of life by 6/30/25. This PR seeks to
upgrade the relevant packages.
Fastify V5 also requires node >=20 now.

Migration docs:
https://fastify.dev/docs/latest/Guides/Migration-Guide-V5/

Luckily many changes were already deprecated from V3->V4 and I have
found no issues running V5 in my production app. The only breaking
change is how Fastify handles the logger, which this PR addresses,
specifically in the
[createServerHelpers.ts](https://github.com/redwoodjs/graphql/compare/main...ladderschool:redwood:main?expand=1#diff-2f9b7c2c7a03d2b1aca7d841ce3365a524a92b7bee07c5177272f1dbf1395d84)
file.

```js
// v5
const loggerInstance = require('pino')()
const fastify = require('fastify')({
  loggerInstance
})
```

There's a test repository that @ladderschool used to confirm these
updates in this PR from:
https://github.com/ladderschool/fastify-v5-test

Local build succeeded: https://cloud.nx.app/runs/saVKz8Qhgn
Local tests succeeded: https://cloud.nx.app/runs/5SujFvDgYM

---------

Co-authored-by: ladderschool <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:breaking This PR is a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants