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

The stream expired due to inactivity with SQLC and turso #1670

Open
DogAndHerDude opened this issue Aug 15, 2024 · 0 comments
Open

The stream expired due to inactivity with SQLC and turso #1670

DogAndHerDude opened this issue Aug 15, 2024 · 0 comments

Comments

@DogAndHerDude
Copy link

DogAndHerDude commented Aug 15, 2024

I'm not sure what I might be doing wrong. Basically if I wait a short while before making first or second connection, I get:

error code = 1: Error executing statement: Hrana: `api error: `{"message":"The stream has expired due to inactivity","code":"STREAM_EXPIRED"}``
2024-08-15T13:47:59.110452Z ERROR libsql_server::hrana::http: hrana server: Stream handle for 15505556566524579603 is expired

I'm running it locally via turso dev --db-file=./dev.db

I'm not sure whether I should be pinging the server before every query? I've tried that, but it seems to not make any difference. Is there a way I should be connecting? I'm using a the most simple way via database/sql in golang. Just a plain ol' conn, err := sql.Open("libsql", "http://...")

The connection is the passed to the sqlc generated function: queries := db.New(conn) which is the passed around by pointer to my services and what not.

Is this the wrong approach or am I missing completely?

Quick edit:

By the looks of it it's only an issue if you're running tuso dev --db-file=.... Obviously, if you just directly point to the file everything is fine, and if you're using the Turso hosted DB it's also fine.

As I understand if you point it to your libsql:/<my-db>.turso.io it also connects via http? Why would it be any different in that case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant