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
[FSTDEP014] FastifyDeprecation: You are trying to set/access the default route. #236
Comments
+1 Experiencing the exact same issue |
That's expected. See fastify/fastify#4480 |
Please read the notice and follow the instructions therein. |
Probably open an issue in fastify-websocket to take care of the Deprecation warning and tag it with good first issue |
We should fix this to use new methods? |
Yes. |
Thanks for the replies and just to confirm, if I get it right, because the call to deprecated methods happens in fastify/fastify-websocket (this repo), we (actually you, the maintainers) will update it someday, right? |
Yes, this module needs to be updated. It is the community's responsibility to keep the things they use updated. This software is provided as-is. |
Do we need to replace |
I would need to see what tests breaks. Ideally, that's what we would do. |
What about replacing the default route logic by prehandler? fastify.addHook("preHandler", (request, reply, done) => {
if (request[kWs]) {
handleUpgrade(request, (connection) => {
noHandle.call(fastify, connection, request);
});
}
done();
}); |
No, they are not identical. Removal of |
Would that change the behavior significantly? |
I believe the impact would be minimal. Current sequenceDiagram
Broswer->>+Server: Initial Connection with WebScoket
Server->>-Broswer: 101 Switch Protocol
Broswer->>+Server: Connection Establish
Server->>-Broswer: Immediate Close
Broswer->>+Broswer: Handle by .onclose
After removal of sequenceDiagram
Broswer->>+Server: Initial Connection with WebScoket
Server->>-Broswer: 404 Not Found
Broswer->>+Broswer: Handle by .onerror or .onclose
|
Seems even better. My guess is that was a relic of some past code. |
Prerequisites
Issue
I start a fastify project with websocket today and receive the following warning:
The relevant lines of code are:
Which might require some refactoring to make it disappear.
The text was updated successfully, but these errors were encountered: