Giter VIP home page Giter VIP logo

enterprise-architectures-and-patterns's Issues

SQLite apps with external libsql provider: stream expired or other invalid connection issues

When either of the SQLite apps (http-crud-go-sqlite or http-crud-js-sqlite) are run using an external libsql provider (specifically, Turso), things work fine for a spell but then after a little while of inactivity, STREAM_EXPIRED and other errors result.

Not sure if this is specific to the provider (Turso) or the underlying sql libraries, or our use of them. I've repro'd on a local turso db as well as a remote turso db, but the steps below will use a local one.

To repro, launch a local turso db in one terminal and then spin up one of the apps with runtime-config pointing to the db in another eg:

turso dev
[sqlite_database.default]
type = "libsql"
url = "http://127.0.0.1:8080"
token = ""
spin up --sqlite @migrations.sql --runtime-config-file runtime-config.toml

REST requests should work initially, but then after a period of time will fail, eg:

$ curl -X GET http://localhost:3000/items
io error: Hrana: `api error: `{"message":"The stream has expired due to inactivity","code":"STREAM_EXPIRED"}``

$ curl -X GET http://localhost:3000/items
io error: Hrana: `api error: `Received an invalid baton``

Here are logs from a turso db running locally:

$ turso dev
sqld listening on port 8080.
Use the following URL to configure your libSQL client SDK for local development:

    http://127.0.0.1:8080

By default, no auth token is required when sqld is running locally. If you want to require authentication, use --auth-jwt-key-file to specify a file containing the JWT key.

This server is using an ephemeral database. Changes will be lost when this server stops.
If you want to persist changes, use --db-file to specify a SQLite database file instead.
2024-07-18T22:15:29.941091Z ERROR libsql_server::hrana::http: hrana server: Stream handle for 2342824010987366139 is expired
2024-07-18T22:29:49.898140Z ERROR libsql_server::hrana::http: hrana server: Stream handle for 2342824010987366139 was not found

Build all Spin Apps as part of a CI workload

All Spin Apps in this repo should be built using a GitHub Action. There are several events that should trigger the workflow:

  • Push to main
  • As part of a PR
  • Whenever a new release of Spin is available

build_with_cors perhaps needs updating?

Hi
Thanks for this repo. Really useful
I am compiling a Rust application that uses CORS.

I am getting the following error when using the build_with_cors function:

 .build_with_cors(&req, &load_cors_config()))
    |          ^^^^^^^^^^^^^^^ ----  ------------------- an argument of type `std::string::String` is missing
    |                          |
    |                          expected `&Method`, found `&Request`

It seems to want 3 arguments:

.build_with_cors(/* &spin_sdk::http::Method */, /* std::string::String */, &load_cors_config()))

Ref: https://github.com/fermyon/enterprise-architectures-and-patterns/blob/main/cors-rust/src/lib.rs#L57

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.