1

sometimes requests are sent while the server is disconnected this leads to errors like:

Error: Unable to execute request: not connected to a Kuzzle server.
Discarded request: ...

Or whats the best practice to handle that kind of situations ?

Currently i just test if my local flag isConnected is set to true or false before sending but i cannot loop forever waiting for kuzzle to be back online. Edit after seeing this doc (offlineMode and autoQueue) : https://docs.kuzzle.io/sdk/js/7/core-classes/kuzzle/constructor/#arguments But after using ofllineMode and autoQueue, when the kuzzle is back online i get :

error: [KuzzleError: Insufficient permissions to execute this action.
         at WebSocketProtocol.query

It seems the deQueue is happening before the jwt token (i'am using apikey) is set. Any advice please ?

ibstelix
  • 103
  • 7

1 Answers1

0

You get this error from Kuzzle because your are probably not authenticated anymore.
It could be your authentication token that expired.

When recovering from connection loss, you may want to login first and then play the offline queue with the Kuzzle.playQueue method. You will also need to set autoReplay to false in Kuzzle constructor

Aschen
  • 1,691
  • 11
  • 15