Error with SQLite in Remix's Jokes App

After deploying Remix’s Jokes App as described in the tutorial, the following error occurs when accessing /jokes in the production environment.
The error does not occur in the local environment.

https://remix.run/docs/en/v1/tutorials/jokes#deployment

2022-02-07T06:14:33.750 app[66f993a3] sin [info] There was an error running the data loader for route routes/jokes

2022-02-07T06:14:33.751 app[66f993a3] sin [info] Error: The table `main.Joke` does not exist in the current database.

2022-02-07T06:14:33.751 app[66f993a3] sin [info] at cb (/app/node_modules/@prisma/client/runtime/index.js:38691:17)

2022-02-07T06:14:33.751 app[66f993a3] sin [info] at async loader3 (/app/build/index.js:752:25)

2022-02-07T06:14:33.751 app[66f993a3] sin [info] at async Object.callRouteLoader (/app/node_modules/@remix-run/server-runtime/data.js:73:14)

2022-02-07T06:14:33.752 app[66f993a3] sin [info] GET /jokes 500 - - 5.340 ms

The fly.toml is as follows.

# fly.toml file generated for remix-jokes-84532361 on 2022-02-07T02:57:13Z

app = "remix-jokes-84532361"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
  DATABASE_URL = "file:./dev.db"
  PORT = 8080

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

It looks like the migrations haven’t been run against the sqlite db. You’ll need to run npx prisma migrate, probably.

1 Like

Thanks for your response.
The result was the same when I logged into the console and ran the migration with the following command.

$ flyctl ssh console -t [SECRET]
# cd app
# npx prisma migrate dev

I have also confirmed that the dev.db file and the migration file exist.

# ls -l app/prisma/  
total 44
-rw-r--r-- 1 root root 32768 Feb  8 04:02 dev.db
drwxr-xr-x 3 root root  4096 Feb  8 04:02 migrations
-rw-r--r-- 1 root root   752 Feb  7 10:01 schema.prisma
-rw-r--r-- 1 root root  1532 Feb  1 12:39 seed.ts
# ls -la app/prisma/migrations
total 8
drwxr-xr-x 2 root root 4096 Feb  8 04:02 20220208040220_init
-rw-r--r-- 1 root root  122 Feb  8 04:02 migration_lock.toml

Did you solve this problem? I’m seeing something similar.