How to use storage volumes for Shopify app (sqlite)?


I have deployed a Shopify app on

It all works well except for storage (volumes).

The Shopify app uses sqlite through prisma.

Its basically a file:

I have created volumes in

in my fly.toml I added these mounts:

Screenshot 2024-02-20 at 3.52.48 pm

When I run my app and access the db, it crashes.

Could someone point me towards what else I need to do?

Did you find a solution to this? It’s strange that the shopify docs don’t address this when discussing fly.

1 Like

What’s in your schema.prisma?

You will typically have something like this:

datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")

Or perhaps:

url      = "file:./dev.db"

What you will want to do is to match that url with the destination of your volume mount, either directly (as a file://// URL) or indirectly via whatever environment variable is defined in that file.

Thanks for this. I also need this solution. I am also facing this problem.

Thanks for your response! Here is my schema:

datasource db {
  provider = "sqlite"
  url      = "file:dev.sqlite"

This is in my fly.toml:


However what wuld be the url path for url? I don’t see where to get the volume url path.

According to the prima docs, you would want something like the following to put the file on that mounted volume:

datasource db {
  provider = "sqlite"
  url      = "file://data/dev.sqlite"

Thank you! How did you do the migration? I set it in my docker file:
RUN npm run setup
I get an Error: Prisma session table does not exist.

Setup/migration of data on volumes will need to be done on the deploy machine, prior to startup. There are a number of ways to do this; perhaps the easiest is to add “npm run setup &&” to the beginning of the “start” script in your “package.json”. This presumes that setup is something that can be run both against an empty database and an existing database.

I have this in my package.json:
"setup": "prisma generate",
should I execute the command in the fly.toml or docker file?

What do you have as your start script in your package.json?

"start": "remix-serve build/index.js",

here si the full scripts in the package.json:

  "scripts": {
    "build": "remix build",
    "predev": "prisma generate",
    "dev": "shopify app dev",
    "config:link": "shopify app config link",
    "generate": "shopify app generate",
    "deploy": "shopify app deploy",
    "config:use": "shopify app config use",
    "env": "shopify app env",
    "start": "remix-serve build/index.js",
    "docker-start": "npm run setup && npm run start",
    "setup": "prisma generate",
    "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
    "shopify": "shopify",
    "prisma": "prisma",
    "graphql-codegen": "graphql-codegen"

I’m not sure why it didn’t reply direclty to you, but I just posted above. Sorry about that.

It looks like docker-start runs setup followed by start. In your Dockerfile, do you have any lines that start with CMD or ENTRYPOINT? What do they contain?

Here is the full docker file:

FROM node:18-alpine



COPY . .

ENV NODE_ENV=production

RUN npm install --omit=dev

RUN npm remove @shopify/app @shopify/cli

RUN npm run build

CMD ["npm", "run", "docker-start"]

That Dockerfile looks good. It runs docker-start, and docker-start is defined as follows:

This should run setup and then after that completes, start.

Here is the error messages after I ran with above.

Error: Prisma session table does not exist. This could happen for a few reasons, see for more information

2024-03-13T20:47:14.526 app[e286003ad26986] sjc [info] at /app/node_modules/@shopify/shopify-app-session-storage-prisma/build/cjs/prisma.js:21:13

2024-03-13T20:47:14.920 app[e286003ad26986] sjc [info] INFO Main child exited normally with code: 1

2024-03-13T20:47:14.920 app[e286003ad26986] sjc [info] INFO Starting clean up.

2024-03-13T20:47:14.920 app[e286003ad26986] sjc [info] INFO Umounting /dev/vdb from /data

2024-03-13T20:47:14.922 app[e286003ad26986] sjc [info] WARN hallpass exited, pid: 315, status: signal: 15 (SIGTERM)

@impactcolor Did you manage to fix this? I am getting the same error “Prisma session table does not exist.”.

From How To to Questions / Help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.