Skip to content
Luna
Esc
↑↓navigate↵open⌘Jpreview
On this page

Closed

An app's call failed because its connection to the luna, or the client itself, is closed.

Closed means the app’s connection to a luna was not open when a call needed it. It comes from the client in your app, so it has no HTTP status.

Issue

A call made with the client from luna/client rejects with a ConnectionError whose code is "Closed". The message says which case it was, such as the connection closed, the client is closed or the client's data was wiped.

Cause

The client sends calls over a connection to each luna. Closed covers each way that connection can end:

  • The connection dropped while the call waited for its answer.
  • The luna closed the connection with conn.close().
  • Your app called client.close(), then made another call.
  • Your app called client.wipe() while writes were still queued.

Closed differs from Unavailable. Unavailable comes from Luna, which refused to start the call. Closed comes from the client, which had no open connection to send it on.

Solution

Retrying a query is safe. A write may have reached the luna before the connection dropped, so check its effect before you send it again.

  • Queued writes and live queries need nothing from you. The client sends them again when the connection comes back, and each queued write carries an idempotency key so it runs once.
  • After client.close(), make a new client with createClient before calling again.
  • If the luna closed the connection on purpose, its close code and reason say why.

Open a connection covers how a connection reconnects.

Was this page helpful?