surrealdb / surrealdb.js

SurrealDB SDK for JavaScript
https://surrealdb.com
Apache License 2.0
294 stars 48 forks source link

Bug: JS Sdk disconnected and couldn't authenticate again #223

Open triracle97 opened 6 months ago

triracle97 commented 6 months ago

Describe the bug

Surrealdb js sdk disconnect and reconnect again but fail to authenticate image

Steps to reproduce

I have a process which listen to a live query using this library and I'm hosting the DB inside docker on an vps, after around 1 day it tried to reconnect and failed to authenticate. My internet connection was ok all the time so I don't know why it disconnected and tried to reconnect.

Here is the code I'm using to connect to my db

const db = new Surreal();

async function initDb() {
  logger.info(`Connecting to ${process.env.SURREAL_URL} with NS ${process.env.ROOT_NS}, DB ${process.env.ROOT_DB}`);
  await db.connect(process.env.SURREAL_URL, {
    auth: {
      username: "root",
      password: "mypassword",
    },
    namespace: process.env.ROOT_NS,
    database: process.env.ROOT_DB,
  });
}

Expected behaviour

The connection should be consistent, and if it disconnect, it should be able to authenticate again

SurrealDB version

v1.3.1

SurrealDB.js version

0.11.0

Contact Details

triracle@gmail.com

Is there an existing issue for this?

Code of Conduct