-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Fastify v4 #224
Update to Fastify v4 #224
Conversation
I missed that change! 😱 Now the
Are we discussing if the |
Exactly
Yes, exactly |
I may have missed this in previous issues re v4, so apologies if this has already been stated, but are we moving to ES modules? |
No. I have changed to |
I think this is okay. I'm really wondering if we should move to removing the callback api completely, but that's a radical idea. We need to fully illustrate this breaking change in the release notes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a nit.
I'm really wondering if we should move to removing the callback api completely, but that's a radical idea.
I agree, maybe deprecating them in v4 and completely remove in v5?
@@ -551,6 +551,6 @@ function createError (code, message, statusCode) { | |||
} | |||
|
|||
module.exports = fp(compressPlugin, { | |||
fastify: '3.x', | |||
fastify: '4.x', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here we can keep ≥3
, as the plugin code doesn't change. It only changes how plugin users are registering it. But this code as is could still work in v3.x
fastify: '4.x', | |
fastify: '>=3.x', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From past experiences, maintaining that is a nightmare. We need separate tests for v3 and v4. I prefer to bump the major so we can avoid any compatibility issues down the line.
v4 is already too late. Let's focus on shipping with the current set of features. |
Maybe it will generate some confusion initially, but having fewer options might be more straightforward to the users in the long run. |
talking about the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Co-authored-by: KaKa <climba03003@gmail.com>
Do we still need |
IMO,
I think it just forgotten to push the related commit. |
Fixed the tag. |
LGTM as well, thanks for bringing me in the loop. Sorry for the headache, now I think I didn't document the changes properly, sorry for that 🙁
Agree |
Due to the changes introduced in fastify/fastify#2954, we need to change how this plugin is registered from:
to
The fundamental problem of the change is that in Fastify v4 routes are now defined synchronously while plugins are defined asynchronously. Therefore requiring the await as there is no library to look for the
onRoute
hook.Note that users of nested plugins are not impacted, so the following will still work:
Are we ok with the change?
cc @metcoder95 @fastify/core @fastify/plugins
Checklist
npm run test
andnpm run benchmark
and the Code of conduct