-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Error Detail:
Version:
client github.com/tursodatabase/go-libsql v0.0.0-20240819180805-a9b092b8bc77
sqld server 0.24.23
Go client:
What would you like to do?
1. Sync with primary
2. Select from test table
3. Insert row to test table
4. Exit
3
panic: failed to execute query INSERT INTO test (id, name) VALUES (random(), lower(hex(randomblob(16))))
error code = 2: Error executing statement: Write delegation: `status: InvalidArgument, message: "x-proxy-authorization not set", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Fri, 06 Sep 2024 22:24:42 GMT", "content-length": "0"} }`
goroutine 1 [running]:
main.main()
/Users/danhtran94/code/go/1loyalty/cmd/app/main.go:145 +0x38
exit status 2
Sqld:
Welcome to sqld!
version: 0.24.23
commit SHA: 73a291355d6dc7a2551d5b510faa2084cf6f4b57
build date: 2024-09-02
This software is in BETA version.
If you encounter any bug, please open an issue at https://github.com/tursodatabase/libsql/issues
config:
- mode: primary (0.0.0.0:5001)
- database path: data/primary.libsql
- extensions path: <disabled>
- listening for HTTP requests on: 127.0.0.1:8080
- grpc_tls: no
2024-09-06T21:52:25.599056Z INFO sqld: listening for incoming user HTTP connection on 127.0.0.1:8080
2024-09-06T21:52:25.599334Z INFO sqld: listening for incoming gRPC connection on 0.0.0.0:5001
2024-09-06T21:52:25.755557Z INFO restore: libsql_server::namespace::meta_store: restoring meta store
2024-09-06T21:52:25.755617Z INFO restore: libsql_server::namespace::meta_store: meta store restore completed
2024-09-06T21:52:25.955692Z INFO libsql_server: Server sending heartbeat to URL <not supplied> every 30s
2024-09-06T21:52:25.955861Z INFO libsql_server::rpc: serving internal rpc server without tls
2024-09-06T21:52:25.957536Z INFO create:try_new_primary:make_primary_connection_maker: libsql_server::replication::primary::logger: SQLite autocheckpoint: 1000
2024-09-06T21:52:30.740129Z ERROR tower_http::trace::on_failure: response failed classification=Code: 3 latency=0 ms
2024-09-06T22:07:36.698283Z ERROR tower_http::trace::on_failure: response failed classification=Code: 3 latency=0 ms
Steps
-
Start local server
sqld --enable-http-console --grpc-listen-addr 0.0.0.0:5001 --db-path data/primary.libsql
-
Connect to local primary sqld server with source below.
primaryUrl := "http://localhost:5001"
dir, err := os.MkdirTemp("", "libsql-*")
if err != nil {
return err
}
defer os.RemoveAll(dir)
# Tried but Error
# connector, err := libsql.NewEmbeddedReplicaConnector(dir+"/test.db", primaryUrl, libsql.WithAuthToken("ANYTHING"))
# Error
connector, err := libsql.NewEmbeddedReplicaConnector(dir+"/test.db", primaryUrl)
if err != nil {
return err
}
defer func() {
if closeError := connector.Close(); closeError != nil {
fmt.Println("Error closing connector", closeError)
if err == nil {
err = closeError
}
}
}()
db := sql.OpenDB(connector)
defer func() {
if closeError := db.Close(); closeError != nil {
fmt.Println("Error closing database", closeError)
if err == nil {
err = closeError
}
}
}()
Metadata
Metadata
Assignees
Labels
No labels