Google Build is not processing env variables from Google Run UI (Missing secret key)

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.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật