Build Logs
2024-06-10 23:25:29.085 CEST
Step #0 - "Build": $ cross-env PAYLOAD_CONFIG_PATH=src/payload/payload.config.ts payload build
2024-06-10 23:26:28.962 CEST
Step #0 - "Build": $ tsc --project tsconfig.server.json
2024-06-10 23:26:45.759 CEST
Step #0 - "Build": $ copyfiles -u 1 "src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,js}" dist/
2024-06-10 23:26:46.842 CEST
Step #0 - "Build": $ cross-env PAYLOAD_CONFIG_PATH=dist/payload/payload.config.js NEXT_BUILD=true node dist/server.js
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": [91munhandledRejection Error: Error: missing secret key. A secret key is needed to secure Payload.
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at BasePayload.init (/home/node/app/node_modules/payload/dist/payload.js:186:19)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at getPayload (/home/node/app/node_modules/payload/dist/payload.js:263:44)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at initHTTP (/home/node/app/node_modules/payload/dist/initHTTP.js:39:51)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at Payload.init (/home/node/app/node_modules/payload/dist/index.js:27:54)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at /home/node/app/dist/server.js:58:60
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at step (/home/node/app/dist/server.js:33:23)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at Object.next (/home/node/app/dist/server.js:14:53)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at /home/node/app/dist/server.js:8:71
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at new Promise (<anonymous>)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at __awaiter (/home/node/app/dist/server.js:4:12)
2024-06-10 23:26:49.683 CEST
Step #0 - "Build": [0m[91merror Command failed with exit code 1.
2024-06-10 23:26:49.683 CEST
Step #0 - "Build": [0minfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2024-06-10 23:26:49.713 CEST
Step #0 - "Build": [91merror Command failed with exit code 1.
2024-06-10 23:26:50.022 CEST
Step #0 - "Build": The command '/bin/sh -c yarn build' returned a non-zero code: 1
Dockerfile
COPY ./package*.json ./
COPY . .
RUN yarn install
RUN yarn build
FROM base as runtime
ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist//payload.config.js
WORKDIR /home/node/app
COPY package*.json ./
RUN yarn install --production
COPY --from=builder /home/node/app/dist ./dist
COPY --from=builder /home/node/app/build ./build
EXPOSE 8080
CMD ["node", "dist/server.js"]
cloudbuild.yaml
I am trying to deploy payloadcms app to google cloud using google build, google run and artifact registry. I added my env variables to google run UI, but somehow its not reading them. Forgive me in advance if i am being stupid, but i am new with google. Thanks for any help.
Build logs
2024-06-10 23:25:29.085 CEST
Step #0 - "Build": $ cross-env PAYLOAD_CONFIG_PATH=src/payload/payload.config.ts payload build
2024-06-10 23:26:28.962 CEST
Step #0 - "Build": $ tsc --project tsconfig.server.json
2024-06-10 23:26:45.759 CEST
Step #0 - "Build": $ copyfiles -u 1 "src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,js}" dist/
2024-06-10 23:26:46.842 CEST
Step #0 - "Build": $ cross-env PAYLOAD_CONFIG_PATH=dist/payload/payload.config.js NEXT_BUILD=true node dist/server.js
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": [91munhandledRejection Error: Error: missing secret key. A secret key is needed to secure Payload.
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at BasePayload.init (/home/node/app/node_modules/payload/dist/payload.js:186:19)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at getPayload (/home/node/app/node_modules/payload/dist/payload.js:263:44)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at initHTTP (/home/node/app/node_modules/payload/dist/initHTTP.js:39:51)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at Payload.init (/home/node/app/node_modules/payload/dist/index.js:27:54)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at /home/node/app/dist/server.js:58:60
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at step (/home/node/app/dist/server.js:33:23)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at Object.next (/home/node/app/dist/server.js:14:53)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at /home/node/app/dist/server.js:8:71
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at new Promise (<anonymous>)
2024-06-10 23:26:49.420 CEST
Step #0 - "Build": at __awaiter (/home/node/app/dist/server.js:4:12)
2024-06-10 23:26:49.683 CEST
Step #0 - "Build": [0m[91merror Command failed with exit code 1.
2024-06-10 23:26:49.683 CEST
Step #0 - "Build": [0minfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2024-06-10 23:26:49.713 CEST
Step #0 - "Build": [91merror Command failed with exit code 1.
2024-06-10 23:26:50.022 CEST
Step #0 - "Build": The command '/bin/sh -c yarn build' returned a non-zero code: 1
Dockerfile
FROM node:18.8-alpine as base
ARG PAYLOAD_SECRET
FROM base as builder
WORKDIR /home/node/app
COPY ./package*.json ./
COPY . .
RUN yarn install
RUN yarn build
FROM base as runtime
ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist//payload.config.js
WORKDIR /home/node/app
COPY package*.json ./
RUN yarn install --production
COPY --from=builder /home/node/app/dist ./dist
COPY --from=builder /home/node/app/build ./build
EXPOSE 8080
CMD ["node", "dist/server.js"]
cloudbuild.yaml
steps:
- name: 'gcr.io/cloud-builders/docker'
args:
- build
- '-t'
- 'europe-west3-docker.pkg.dev/payloaddocker/payload:test' # Temporary tag for testing
- '-f'
- './Dockerfile'
- '.'
- '-e'
- 'PAYLOAD_SECRET=7d80c883e81f5b7b859245f3'
dir: '.'
# Push step (temporary tag)
- name: 'gcr.io/cloud-builders/docker'
args:
- push
- 'europe-west3-docker.pkg.dev/payloaddocker/payload:test' # Temporary tag for testing
# Deployment step (temporary tag)
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: gcloud
args:
- run
- deploy
- 'paycloud' # Replace with your service name
'--region=europe-west3'
'--platform=managed'
'--image=europe-west3-docker.pkg.dev/payloaddocker/payload:test' # Temporary tag for testing
timeout: 1800s
docker-compose.yml
version: '3'
services:
payload:
image: node:18-alpine
ports:
- '3000:3000'
volumes:
- .:/home/node/app
- node_modules:/home/node/app/node_modules
working_dir: /home/node/app/
command: sh -c "yarn install && yarn dev"
depends_on:
- mongo
env_file:
- .env
mongo:
image: mongo:latest
ports:
- '27017:27017'
command:
- --storageEngine=wiredTiger
volumes:
- data:/data/db
logging:
driver: none
volumes:
data:
node_modules:
I am trying to deploy next js app with express to google cloud using google build, google run and artifact registry. I added my env variables to google run UI, but somehow its not reading them. Forgive me in advance if i am being stupid, but i am new with google. Thanks for any help.