surrealdb-client-generator icon indicating copy to clipboard operation
surrealdb-client-generator copied to clipboard

Trouble connecting to my surrealdb instance

Open jascenc1 opened this issue 10 months ago • 1 comments

I've been attempting to use the SurrealDB Schema Generator to generate zod schemas and TypeScript clients for my SurrealDB database. While the generator works flawlessly when using the "memory" connection URL, I encounter issues when trying to connect to my local SurrealDB instance running via Docker. Specifically, the process hangs indefinitely with a "connect to database" message and fails to proceed further. I'm also able to connect to surrealist.app with the information I add to the config file.

Configuration Used

Below is the surql-gen.json configuration file I'm using:

{
  "schemaFile": "schema.surql",
  "surreal": "memory",
  "username": "my_username",
  "password": "my_secret_password",
  "ns": "my_namespace",
  "db": "my_database",
  "outputFolder": "./path/to/outdir",
  "generateClient": true,
  "lib": "surrealdb.js"
}

Connection URLs Attempted

I've tried various URLs to connect to my local SurrealDB instance:

  • http://localhost:8000
  • http://localhost:8000/
  • ws://127.0.0.1:8000/rpc
  • ws://127.0.0.1:8000

Additionally, I've confirmed that my normal connection method to SurrealDB using surrealdb.js is through WebSocket URLs like ws://127.0.0.1:8000/rpc, which works fine in my application, but seems incompatible with the schema generator's requirements.

Environment:

Node: 18.19.0 npm: 10.2.3 SurrealDB.js: 0.11.0 sebastianwessel/surql-gen: 1.1.2

jascenc1 avatar Apr 09 '24 22:04 jascenc1