Realtime connections giving `TIMED_OUT` errors
如果你应用里的实时连接出现 TIMED_OUT 错误,这通常意味着你在 supabase-js 客户端库包中使用的 realtime-js 版本和你的 Node.js 版本不兼容。这个问题通常出现在用旧于 v22 的 Node.js 版本配合更新的 supabase-js 版本时。
🌐 If your Realtime connections in your application are giving TIMED_OUT errors, this often indicates an incompatibility between the version of realtime-js being used in your supabase-js client library package and your Node.js version. This issue happens when using versions of Node.js older than v22 with more recent versions of supabase-js.
为什么会发生这种情况: 这是由于为修复各种问题所做的根本性更改导致的。有关为什么会进行此更改以及解决方法的更多详细信息,请参见:https://github.com/orgs/supabase/discussions/37869
如何解决这个问题:
有两个主要方法可以解决这个问题:
🌐 There are two primary options to fix this:
- 升级 Node.js:将你的 Node.js 版本升级到最新的长期支持(LTS)版本,例如截至 2025 年 11 月的 Node.js v24。
- 明确设置 WebSocket 传输:请查看上面链接的 GitHub 讨论获取详细指南。