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

SQLiteError: no such table: user #133

Open
tehniemer opened this issue Sep 28, 2024 · 3 comments
Open

SQLiteError: no such table: user #133

tehniemer opened this issue Sep 28, 2024 · 3 comments

Comments

@tehniemer
Copy link

tehniemer commented Sep 28, 2024

Followed the docker install instructions and was presented with the following error when trying to access the service.

SQLiteError: no such table: user
�
1
      at prepare (bun:sqlite:280:10)
      at prepareQuery (/app/node_modules/drizzle-orm/bun-sqlite/session.js:20:30)
      at _prepare (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:572:73)
      at all (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:588:17)
      at execute (/app/node_modules/drizzle-orm/sqlite-core/query-builders/select.js:596:19)
      at then (/app/node_modules/drizzle-orm/query-promise.js:21:17)
15 |   logger;
16 |   exec(query) {
17 |     this.client.exec(query);
18 |   }
19 |   prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) {
20 |     const stmt = this.client.prepare(query.sql);

Here's my compose snippet

services:
  grimoire:
    image: goniszewski/grimoire:develop
    build:
      context: .
      dockerfile: Dockerfile
    container_name: grimoire
    restart: unless-stopped
    networks:
      - traefik
    ports:
      - $GRIMOIRE_PORT:5173
    security_opt:
      - no-new-privileges=true
    logging:
      options:
        max-size: 2m
        max-file: "3"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /opt/docker/grimoire:/app/data/
    environment:
      - PORT=5173
      - PUBLIC_HTTPS_ONLY=false
      - PUBLIC_SIGNUP_DISABLED=false
    labels:
      - homepage.group=Containers
      - homepage.name=Grimoire
      - homepage.icon=grimoire
      - homepage.description=Bookmark Management
      - homepage.href=https://grimoire.$DOMAINNAME
      - homepage.siteMonitor=http://$HOST:$GRIMOIRE_PORT
      - traefik.enable=true
      - traefik.http.routers.grimoire-rtr.entrypoints=https
      - traefik.http.routers.grimoire-rtr.rule=Host(`grimoire.$DOMAINNAME`)
      - traefik.http.routers.grimoire-rtr.middlewares=chain-no-auth@file # No Authentication
      - traefik.http.routers.grimoire-rtr.service=grimoire-svc
      - traefik.http.services.grimoire-svc.loadbalancer.server.port=5173
@goniszewski
Copy link
Owner

Hello @tehniemer!

Could you try to set up the app again using the latest tag for the Docker image (develop may be missing some latest hotfixes)?

Also, make sure to remove existing Docker volume used by Grimoire and allow it to create a new one.

@tehniemer
Copy link
Author

tehniemer commented Sep 28, 2024

Sure thing, after removing the existing mountpoint and changing to the latest tag I get the following errors

$ bun run ./migrate
1 | import { Database } from 'bun:sqlite';
2 | import { drizzle } from 'drizzle-orm/bun-sqlite';
3 | import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
4 | 
5 | const sqlite = new Database('data/db.sqlite');
                   ^
SQLiteError: unable to open database file
 errno: 14
  code: "SQLITE_CANTOPEN"
      at new Database (bun:sqlite:178:14)
      at /app/migrate.js:5:16
Bun v1.1.29 (Linux x64 baseline)
error: script "run-migrations" exited with code 1
$ bun run ./migrate
1 | import { Database } from 'bun:sqlite';
2 | import { drizzle } from 'drizzle-orm/bun-sqlite';
3 | import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
4 | 
5 | const sqlite = new Database('data/db.sqlite');
                   ^

Maybe a permissions issue with the bind mount? What UID and GID does the container run?

@goniszewski
Copy link
Owner

I've tried to reproduce your issue, but unsuccessfully. For the permissions used, please check this line in the Dockerfile: https://github.com/goniszewski/grimoire/blob/main/Dockerfile#L11

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

2 participants