Fastify 3.10 breaks prefixed plugins
Skn0tt opened this issue ยท 2 comments
Skn0tt commented
๐ Bug Report
Fastify 3.10, together with the use of prefixes, breaks fastify-websocket
.
fastify.register(
(fastify, opts, done) => {
fastify.get("/", { websocket: true }, (connection, req) => {
connection.socket.send("This works");
});
done();
},
{ prefix: "/activity" }
);
To Reproduce
- Clone https://github.com/Skn0tt/fastify-websocket-3.10-repro
- Run
index.js
- Connect to
ws://localhost:3000/activity
Your Environment
- node version: 15.3
- fastify version: >=3.10
- os: Mac
Some ideas as to what may be causing this
Prior to 3.10, this line was called twice per route:
Line 36 in 99c94a0
That's why this lines makes sure to ignore one of them:
Line 42 in 99c94a0
Now with 3.10, the onRoute
is called only once, and all of the routes are effectively ignored.
originally encountered in quirrel-dev/quirrel#49
mcollina commented
I agree with your analysis! Would you like to send a PR to fix this module?