Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble connecting to my surrealdb instance #6

Closed
jascenc1 opened this issue Apr 9, 2024 · 3 comments
Closed

Trouble connecting to my surrealdb instance #6

jascenc1 opened this issue Apr 9, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@jascenc1
Copy link

jascenc1 commented Apr 9, 2024

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

@sebastianwessel
Copy link
Owner

Hey,
thanks for your feedback and sorry for the delay.
I have released version 1.1.3 which has changes in the authentication.

Maybe you want to try out again and let me know if there is still an issue?
As far as I understand, you use a SurrealDB instance within a local docker container with authentication?

@lylejohnson
Copy link

Yes, we're running a local SurrealDB instance (with authentication enabled) in a Docker container. With @sebastianwessel/surql-gen version 1.1.3, values of "ws://127.0.0.1:8000" and "ws://127.0.0.1:8000/rpc" work now for the "surreal" parameter in our surql-gen.json file, so this problem is resolved for us. Note that the "http://127.0.0.1:8000" and "http://127.0.0.1:8000/" values still don't work; I get an error message like so:

$ npx surql-gen -c surql-gen.json
connect to database
node:internal/process/promises:289
        triggerUncaughtException(err, true /* fromPromise */);
        ^

[Error: There was a problem with the underlying datastore: Cannot connect to the 'HTTP' remote engine as it is not enabled in this build of SurrealDB] { code: 'GenericFailure' }

@sebastianwessel sebastianwessel added the bug Something isn't working label Jun 6, 2024
@sebastianwessel
Copy link
Owner

The issue should now be resolved.
See Version 2 Release Note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants