Failure to deploy RedwoodJS app with with because fly can't find the schema.prisma file

I’m trying to deploy an existing RedwoodJS app with

I have verified that I can create a new redwood app and deploy via fly launch but when I fly launch from my other app, I see this failure.

It probably goes without saying I do have a schema.prisma file defined and the redwood app is pretty boilerplate here. Nothing out of the ordinary.

The key failure is here:

Skipping database and Prisma client generation, no `schema.prisma` file found: `/app/api/db/schema.prisma`

Rest of the output here:

 => CANCELED [api_build 2/2] RUN yarn rw build api                                                                                                                                                     9.8s
 => ERROR [web_build 2/2] RUN yarn rw build web                                                                                                                                                        9.5s
 > [web_build 2/2] RUN yarn rw build web:
#0 9.296 ❯ Generating Prisma Client...
#0 9.297 Skipping database and Prisma client generation, no `schema.prisma` file found: `/app/api/db/schema.prisma`
#0 9.300 ✖ Generating Prisma Client... [FAILED: Command failed with ERR_INVALID_ARG_TYPE:
#0 9.300 The "file" argument must be of type string. Received undefined]
#0 9.301
#0 9.313 ┌ Error ───────────────────────────────────────────────────────────────────────┐│                                                                              ││   TypeError [ERR_INVALID_ARG_TYPE]: Command failed with                      ││   ERR_INVALID_ARG_TYPE:                                                      ││   The "file" argument must be of type string. Received undefined
││   at new NodeError (node:internal/errors:371:5)                              ││   at validateString (node:internal/validators:119:11)                        ││   at normalizeSpawnArguments (node:child_process:503:3)                      ││   at Object.spawn (node:child_process:691:13)                                ││   at execa (/app/node_modules/execa/index.js:83:26)                          ││   at _Task.task [as taskFn]                                                  ││   (/app/node_modules/@redwoodjs/cli/dist/commands/buildHandler.js:73:33)     ││   at (/app/node_modules/listr2/dist/index.cjs:2049:35)             ││                                                                              ││                                                                              ││                                                                              ││   Need help?                                                                 ││   - Not sure about something or need advice? Reach out on our Forum          ││   (                                       ││   - Think you've found a bug? Open an issue on our GitHub                    ││   (                                   ││   - Here's your unique error reference to quote:                             ││   'f2c0c856-66de-4cca-95c5-5aaba149fad7'                                     ││                                                                              │└──────────────────────────────────────────────────────────────────────────────┘
Error: failed to fetch an image or build from source: error building: failed to solve: executor failed running [/bin/sh -c yarn rw build web]: exit code: 1

Can you post your Dockerfile? It is possible that this step is being run before the COPY statement that loads your entire application (normally something like COPY . .) is run.

Here it is. All of the defaults - I didn’t change anything.

ARG BASE_IMAGE=node:16.13.0-alpine
FROM ${BASE_IMAGE} as base

RUN mkdir /app

# Required for building the api and web distributions
ENV NODE_ENV development

FROM base as dependencies

COPY .yarn .yarn
COPY .yarnrc.yml .yarnrc.yml
COPY package.json package.json
COPY web/package.json web/package.json
COPY api/package.json api/package.json
COPY yarn.lock yarn.lock

RUN --mount=type=cache,target=/root/.yarn/berry/cache \
    --mount=type=cache,target=/root/.cache yarn install --immutable

COPY redwood.toml .
COPY graphql.config.js .

FROM dependencies as web_build

COPY web web
RUN yarn rw build web

FROM dependencies as api_build

COPY api api
RUN yarn rw build api

FROM dependencies

ENV NODE_ENV production

COPY --from=web_build /app/web/dist /app/web/dist
COPY --from=api_build /app/api /app/api
COPY --from=api_build /app/node_modules/.prisma /app/node_modules/.prisma

COPY .fly .fly

CMD [".fly/"]

The redwood team is working on a new dockerfile. You can get a sneak peek at the result here:

But for now, and with the Dockerfile that you have, you may need to add some COPY statements. The first block of COPY statements copy all of the files needed to install dependencies. Basically the yarn install command will only be run if any of these files change.

A total of three files are copied before yarn rw build web is run. It looks like with your project you need to add prisma to this list.

Thank you for the help @rubys .
The deployment is successful for me but I the site is unreachable. I think because of this warning during deployment.

WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
  - for job

Do you have any idea how to resolve this for a RedwoodJS app? I’ve verified my Redwood.toml/fly.toml/Dockerfile are consistent with the ticket-badge-app you linked above.

Aha! Figured it out. Just needed to add:

host = ""

to both the [api] and [web] sections of the redwood.toml file.

1 Like