surrealdb / surrealdb.go

SurrealDB SDK for Golang
https://surrealdb.com
Apache License 2.0
244 stars 66 forks source link

Bug: unavailable ErrorChannel #186

Open EtienneBruines opened 4 days ago

EtienneBruines commented 4 days ago

Describe the bug

When trying to upsert a record, there seems to be some internal issues with surrealdb.go

Steps to reproduce

Do something that surrealdb.go doesn't really know how to work with:

import (
    "github.com/google/uuid"
)

id, _ := uuid.New()  // id is now a [16]byte internally

_, err = surrealdb.Upsert[struct{}](
    surrealConn,
    models.RecordID{Table: "application", ID: id},
    map[string]interface{}{
    "name":            "my application",
    "organization_id": "abc",
    })

Or something like this:

import "time"

_, err = surrealdb.Upsert[struct{}](
    surrealConn,
    models.RecordID{Table: "application", ID: "app123"},
    map[string]interface{}{
    "name":            "my application",
    "organization_id": "abc",
        "updated":         time.Now(),
    })

This returns (after a while) a timeout error.

In the meanwhile (pretty much instantly), these two are logged on the application (surrealdb.go):

{"time":"2024-11-14T09:39:19.53318052Z","level":"ERROR","msg":"rpc request err Invalid Request"}
{"time":"2024-11-14T09:39:19.533198765Z","level":"ERROR","msg":"unavailable ErrorChannel <nil>"}

Using the full logs on surrealdb, only this is logged at/around that same time:

DEBUG rpc/call: surreal::rpc::response: Process RPC response otel.kind="server" ws.id=ac1fbd7f-9260-4ec9-8e53-94912c8d446d rpc.service="surrealdb"

Expected behaviour

  1. Always have the err be populated instead of timed out.
  2. The upsert statement to work.

SurrealDB version

surreal 2.0.4 for linux on x86_64; surrealdb.go at v0.3.0 https://github.com/surrealdb/surrealdb.go/commit/184f6bf409d80d5cdba12e89c04f5c67ec35f334

Contact Details

No response

Is there an existing issue for this?

Code of Conduct