anyone here use prisma with google cloud run? I’m...
# orm-help
a
anyone here use prisma with google cloud run? I’m setting up my dockerfile and trying to run
prisma migrate deploy
during the build step and im getting this error:
Copy code
[builder 7/9] RUN npx prisma migrate deploy:
#11 1.611 Prisma schema loaded from prisma/schema.prisma
#11 1.644 Error: Get config: Schema Parsing P1012
#11 1.644
#11 1.644 error: Environment variable not found: DATABASE_URL.
#11 1.644   -->  schema.prisma:6
#11 1.644    |
#11 1.644  5 |   provider = "postgresql"
#11 1.644  6 |   url      = env("DATABASE_URL")
#11 1.644    |
#11 1.644
#11 1.644 Validation Error Count: 1
#11 1.644
I have the
DATABASE_URL
environment variable set inside of the cloud run service environment but I have a feeling this is probably not helpful during the build step as I believe that is a runtime concern. anyone have any thoughts or suggestions on this flow/problem?
r
@Antoin Campbell 👋
migrate deploy
needs the environment variable. Could you make sure that it’s accessible inside the container by echoing the variable? If it’s available, then this is a bug that you can create an issue for here.
a
thanks for responding @Ryan its not accessible! so I need to figure out whats going on with my docker build. any ideas why my
.env
file is not accessible/being read in my docker container?
r
I’m not sure in this case. Does passing the environment variables in the
Variables and Secrets
tab not reflect in the container?
a
im not sure I know what the
Variables and Secrets
tab is? could you expand on that? I just have a
.env
file in the root of the application.
r
Cloud Run UI has a way of injecting variables. So could you try and pass those?
I just have a 
.env
 file in the root of the application.
This should work. Does the container have the
.env
file present?
a
right, I have it in cloud run as well. maybe im doing something wrong in my
Dockerfile
because the
.env
is not present. Here is my
Dockerfile
:
Copy code
FROM node:14 AS base

WORKDIR /usr/src/app

FROM base AS build

COPY package*.json ./
COPY prisma ./prisma/

RUN yarn install --production
RUN npx prisma generate
# RUN npx prisma migrate deploy
COPY ./ ./

RUN yarn build

FROM base AS runtime

COPY --from=build /usr/src/app/node_modules ./node_modules
COPY --from=build /usr/src/app/package.json ./
COPY --from=build /usr/src/app/yarn.lock ./
COPY --from=build /usr/src/app/dist ./dist

# Run the web service on container startup.
CMD [ "yarn", "start:prod"]
r
Your
Dockerfile
seems fine.
a
I thought so too 😕