CodexBloom - Programming Q&A Platform

GCP Cloud Build scenarios with 'how to read properties of undefined' scenarios When Using Custom Node.js Dockerfile

👀 Views: 0 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-14
gcp cloud-build docker node.js javascript

I'm converting an old project and I'm deploying to production and I'm reviewing some code and This might be a silly question, but I'm currently working with an scenario with GCP Cloud Build where my builds unexpected result with the behavior message `want to read properties of undefined (reading 'split')`..... This occurs when I'm trying to deploy a Node.js application using a custom Dockerfile. My Dockerfile is set up to use Node.js 16 and is structured as follows: ```dockerfile FROM node:16 WORKDIR /app COPY package*.json ./ RUN npm install COPY . . CMD [ "npm", "start" ] ``` In my `cloudbuild.yaml`, I'm using the following configuration: ```yaml steps: - name: 'gcr.io/cloud-builders/docker' args: ['build', '-t', 'gcr.io/$PROJECT_ID/my-node-app', '.'] - name: 'gcr.io/cloud-builders/docker' args: ['push', 'gcr.io/$PROJECT_ID/my-node-app'] - name: 'gcr.io/google.com/cloud-sdk/gcloud' args: ['run', 'deploy', 'my-node-app', '--image', 'gcr.io/$PROJECT_ID/my-node-app', '--platform', 'managed'] timeout: 900s ``` I've checked my `package.json` for any missing scripts and everything seems fine. I've also tried running `gcloud builds submit` locally with the same Dockerfile and it works without issues. The Cloud Build logs show that the behavior occurs right after the Docker image is built but before it is pushed to the registry. I've also ensured that all environment variables are correctly set in the Cloud Build settings. Could this be related to a specific configuration in the Cloud Build service or am I missing something crucial in my Dockerfile or `cloudbuild.yaml`? Any insights would be greatly appreciated! For context: I'm using Javascript on Windows 11. Thanks, I really appreciate it! I'm working on a desktop app that needs to handle this. What am I doing wrong? I'm coming from a different tech stack and learning Javascript. Thanks for your help in advance!