hyperjumptech/monika

Spike on moving SQLite3 to another library

dennypradipta opened this issue · 2 comments

SQLite3 seems broken when building Monika using Docker in Apple silicone macs. So I've made a sample POC on using Better SQLite3:

index.js

const db = require("better-sqlite3")("foobar.db", {});

const row = db.prepare("SELECT * FROM users WHERE id = ?").get(1);
console.log(row.firstName, row.lastName, row.email);

Dockerfile

FROM node:20-alpine

COPY . .
RUN npm ci

CMD ["node", "index.js"]

package.json

{
  "name": "bsqlite3",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "better-sqlite3": "^11.1.1"
  }
}

I've been able to build Dockerfile, run it using NPM, run it using Docker in Apple Silicone Macs without any issues, so moving to Better SQLite3 may helps.

Please check the pull request #1304, and close the issue if it solves the issue.

Closed by #1304