#7502·trpc

bug: PING sent twice when keepAlive is enabled in fastifyTRPCPlugin

Author: 01101101Created Aug 27, 2026Updated Sep 6, 2026
Labels🐛 bug: unconfirmed

Provide environment information

Not needed.

Describe the bug

‎fastifyTRPCPlugin calls ‎handleKeepAlive when trpcOptions?.keepAlive?.enabled is true.

But fastifyTRPCPlugin also calls getWSConnectionHandler, which again calls handleKeepAlive if opts.keepAlive?.enabled is true.

So the handler is called twice and 2 PING messages are sent each time.

Link to reproduction

Not needed.

To reproduce

Enable keepAlive in fastifyTRPCPlugin.

Additional information

No response

‍‍ Contributing

  • ‍♂️ Yes, I'd be down to file a PR fixing this bug!