Bug with @shopify/shopify-app-session-storage-sqlite@5.0.0 and @shopify/shopify-app-session-storage-postgresql@4.0.20

Bug with @shopify/shopify-app-session-storage-sqlite@5.0.0 and @shopify/shopify-app-session-storage-postgresql@4.0.20

Hi community,

I’m developing my first Shopify app, “Price Tier Finder” (custom/private), and facing persistent issues with session storage packages. Despite a successful psql test with Render PostgreSQL, I’m hitting SSL/TLS errors with PostgreSQL and SQLite initialization failures. Help appreciated!

Environment:

- Node.js: v22.15.0
- OS: macOS (Mac Studio)
- Database: Render PostgreSQL - `postgres://user:pass@url:5432/table_name?sslmode=require`

package.json:

{
  "name": "shopify-draft-helper",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": { "start": "node index.js", "dev": "nodemon index.js" },
  "dependencies": {
    "@shopify/shopify-app-express": "^5.0.20",
    "@shopify/shopify-app-session-storage-postgresql": "^4.0.20",
    "@shopify/shopify-app-session-storage-sqlite": "^5.0.0",
    "dotenv": "^17.2.2",
    "express": "^5.1.0",
    "install": "^0.13.0",
    "pg": "^8.16.3",
    "sqlite3": "^5.1.7"
  },
  "devDependencies": { "nodemon": "^3.1.10" }
}

Simplified .js

import dotenv from “dotenv”;
dotenv.config();

import express from “express”;
import { SQLiteSessionStorage } from “@shopify/shopify-app-session-storage-sqlite”;

console.log(" Starting Shopify Draft Helper…");
console.log(“DATABASE_URL:”, process.env.DATABASE_URL ? “Found” : “Missing”);

const app = express();
const PORT = process.env.PORT || 3000;

const sessionStorage = new SQLiteSessionStorage({
databasePath: “./sessions.db”, // Local SQLite file
});

console.log(“Session storage initialized with databasePath: ./sessions.db”);

sessionStorage.ready
.then(() => console.log(" SQLite session storage initialized"))
.catch(err => {
console.error(" SQLite session storage failed:", err);
process.exit(1);
});

app.listen(PORT, () => {
console.log(```  Server is running at ``http://localhost``:${PORT} ```);
});

ENV

DATABASE_URL=postgres://user:pass@url:5432/table_name?sslmode=require
SHOPIFY_SHOP_DOMAIN=pkdotbiz.myshopify.com
SHOPIFY_API_KEY=****
SHOPIFY_API_SECRET=****
SHOPIFY_SCOPES=read_customers,read_draft_orders,write_draft_orders,read_products,write_products
SHOPIFY_HOST=https://<<url>>.onrender.com
SHOPIFY_API_VERSION=2025-01

Errors:

Postgres init failed: error: SSL/TLS required
at …/pg-pool/index.js:45:11
at process.processTicksAndRejections (…)
at async PostgresConnection.query (…)
at async PostgreSQLSessionStorage.createTable (…)
at async PostgreSQLSessionStorage.init (…)
at async PostgresSessionStorageMigrator.applyMigrations (…) {
code: ‘28000’, severity: ‘FATAL’, …
}

and

SQLite session storage failed: TypeError: this.db.all is not a function
at …/sqlite-connection.js:16:21
at new Promise ()
at SqliteConnection.query (…)
at async SqliteConnection.hasTable (…)
at async SQLiteSessionStorage.init (…)
at async SqliteSessionStorageMigrator.applyMigrations (…)

Steps Tried:

  • PostgreSQL: SSL configs, custom pg.Pool, monkey-patches.
  • SQLite: Switch, sqlite3 rebuilds/prebuilt binaries.
  • Debugged exports, adjusted ES module imports.

Request:

  • Seeking fix/workaround for these session storage bugs.
  • Guidance on peer conflict ( @shopify/shopify-api@11.14.1 vs. ^12.0.0).

Thank you!
Chris

Hi there :waving_hand:

Sorry that you ran into this!

A couple of questions

  1. Does this only happen when you are using render, or does it happen when you run your db locally?
  2. Are you using the Shopify App Template Node? Or are you rolling your own?
  3. Are you trying to use both postgres and sqlite at the same time? Or you are only wanting to use one, but you have tried test both, and ran into issues with both?

It would be super helpful if you are able to provide a minimal repo that I could run to reproduce the issue, just so I can ensure I am setting up the application in the exact same manner as you are!