boxyhq / jackson

🔥 Streamline your web application's authentication with Jackson, an SSO service supporting SAML and OpenID Connect protocols. Beyond enterprise-grade Single Sign-On, it also supports Directory Sync via the SCIM 2.0 protocol for automatic user and group provisioning/de-provisioning. 🤩
https://boxyhq.com/docs/jackson/overview
Apache License 2.0
1.81k stars 153 forks source link

Turso stream inactive error #2775

Closed nadilas closed 4 months ago

nadilas commented 4 months ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @boxyhq/saml-jackson@1.26.2 for the project I'm working on.

Using turso db with the latest update still runs into a stream inactive issue based on typeorm's https://github.com/typeorm/typeorm/issues/10451#issuecomment-1905201669 issue and solution, here is the diff that solved my problem:

diff --git a/node_modules/@boxyhq/saml-jackson/dist/db/sql/sql.js b/node_modules/@boxyhq/saml-jackson/dist/db/sql/sql.js
index 0e7842a..b8b6a56 100644
--- a/node_modules/@boxyhq/saml-jackson/dist/db/sql/sql.js
+++ b/node_modules/@boxyhq/saml-jackson/dist/db/sql/sql.js
@@ -62,7 +62,12 @@ class Sql {
                         this.dataSource = new typeorm_1.DataSource(Object.assign({ host: mssqlOpts.host, port: mssqlOpts.port, database: mssqlOpts.database, username: mssqlOpts.username, password: mssqlOpts.password, options: mssqlOpts.options }, baseOpts));
                     }
                     else if (sqlType === 'sqlite') {
-                        this.dataSource = new typeorm_1.DataSource(Object.assign({ database: this.options.url, driver: require('@libsql/sqlite3') }, baseOpts));
+                        this.dataSource = new typeorm_1.DataSource(Object.assign({
+                            database: this.options.url, driver: require('@libsql/sqlite3')
+                                ...(this.options.url.startsWith('libsql') ? {
+                                    flags: 0x00000040 // this is required to make turso work in TypeORM
+                                } : {})
+                        }, baseOpts));
                     }
                     else {
                         this.dataSource = new typeorm_1.DataSource(Object.assign({ url: this.options.url, ssl: this.options.ssl }, baseOpts));

This issue body was partially generated by patch-package.

deepakprabhakara commented 4 months ago

Fixed in v1.26.3