#WebSocket connection failed

4 messages · Page 1 of 1 (latest)

proud iris
#

Attempting reconnect in 10563ms
WebSocket reconnected at t=46.8s after disconnect due to ServiceUnavailable
WebSocket closed with code 1013: ServiceUnavailable
็How to fix

north cedarBOT
#

Hi @proud iris. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The ServiceUnavailable / WebSocket close code 1013 error typically indicates a temporary backend service disruption on Convex's side, not something caused by your code.

Here's what you can do:

1. Check Convex's Status Page

First, verify if there's an ongoing outage:
👉 **https://status.convex.dev/**

Also check the Convex Discord's general/announcements channel, as community members often report issues there before the status page is updated. [Convex Status]

2. Wait and Retry

The Convex client automatically handles reconnection for you. As noted in the docs:

"If the internet connection drops, the client will handle reconnecting and re-establishing the Convex session automatically." [Convex React]

So in most cases, you don't need to do anything — the client will keep retrying (as you can see from the Attempting reconnect in 10563ms message in your logs).

3. Monitor Connection State (Optional)

If you want to observe and react to connection issues in your app, you can use the connectionState property or the onServerDisconnectError callback when initializing your Convex client:

const client = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!, {
  onServerDisconnectError: (message) => {
    console.error("Disconnected from Convex:", message);
    // e.g., show a UI banner to the user
  },
});

Note that this API is marked as experimental and may change. [ConvexReactClientOptions]

#

4. If You're on a Pro Plan

If this is a critical blocker and you're on a Pro plan, you can open a support issue directly via the Convex dashboard for faster assistance. [WebSocket 1011 thread]

In summary, ServiceUnavailable is a transient server-side error. The Convex client will reconnect automatically, and the issue typically resolves on its own once the backend recovers.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: