<p>Been working fine for months and quit working two days ago. Don't recall changing anything in the <code>.yamls</code>. </p>

<p>Basically, when I start up the <code>create-react-app</code>, the <code>create-react-app</code> client just starts, fails and restarts.</p>

<p>I've tried:</p>

<ul>
<li>Reverting to a previous commit when it was working</li>
<li>Downgrading/upgrading <code>skaffold</code></li>
<li>Downgrading/upgrading <code>minikube</code></li>
<li>Downgrading/upgrading <code>kubectl</code></li>
<li>Testing Ubuntu 19.10, macOS 10.15.3, and Windows 10 (WSL2) and the issue persists in all of them</li>
</ul>

<p>It appears to be an issue with <code>skaffold</code> and <code>create-react-app</code> as the following still works fine:</p>

<ul>
<li>The <code>api</code> and <code>postgres</code> pods still launch and run perfectly fine</li>
<li>The following works normally which, to me, indicates it isn't a <code>create-react-app</code> issue:</li>
</ul>

<pre><code>cd client
npm install
npm start
</code></pre>

<ul>
<li>The following also works normally which, to me, indicates it isn't a <code>docker</code> issue:</li>
</ul>

<pre><code>cd client
docker build -f Dockerfile.dev .
docker run -it -p 3000:3000 &lt;image_id&gt;
</code></pre>

<ul>
<li>I don't think it is a Kubernetes issue. I pushed to my staging branch, triggering the staging CI/CD pipeline, passed build and deployment, and it is operating normally at my staging URL.</li>
</ul>

<p>This is what I have for the configs:</p>

<pre><code># client.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-deployment-dev
spec:
  replicas: 1
  selector:
    matchLabels:
      component: client
  template:
    metadata:
      labels:
        component: client
    spec:
      containers:
        - name: client
          image: client
          ports:
            - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: client-cluster-ip-service-dev
spec:
  type: ClusterIP
  selector:
    component: client
  ports:
    - port: 3000
      targetPort: 3000
</code></pre>

<pre><code>#skaffold.yaml

apiVersion: skaffold/v1beta15
kind: Config
build:
  local:
    push: false
  artifacts:
    - image: client
      context: client
      docker:
        dockerfile: Dockerfile.dev
      sync:
        manual:
          - src: "***/*.js"
            dest: .
          - src: "***/*.jsx"
            dest: .
          - src: "***/*.json"
            dest: .
          - src: "***/*.html"
            dest: .
          - src: "***/*.css"
            dest: .
          - src: "***/*.scss"
            dest: .
deploy:
  kubectl:
    manifests:
      - manifests/dev/client.yaml
</code></pre>

<pre><code># Dockerfile.dev

FROM node:13-alpine
WORKDIR /app
COPY ./package.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]
</code></pre>

<p><code>-v DEBUG</code> log:</p>

<pre><code> $ skaffold dev -v DEBUG
INFO[0000] starting gRPC server on port 50051           
INFO[0000] starting gRPC HTTP server on port 50052      
INFO[0000] Skaffold &amp;{Version:v1.6.0-docs ConfigVersion:skaffold/v2beta1 GitVersion: GitCommit:b74e2f94f628b16a866abddc2ba8f05ce0bf956c GitTreeState:clean BuildDate:2020-03-25T00:09:12Z GoVersion:go1.14 Compiler:gc Platform:linux/amd64} 
DEBU[0000] config version (skaffold/v1beta15) out of date: upgrading to latest (skaffold/v2beta1) 
DEBU[0000] validating yamltags of struct SkaffoldConfig 
DEBU[0000] validating yamltags of struct Metadata       
DEBU[0000] validating yamltags of struct Pipeline       
DEBU[0000] validating yamltags of struct BuildConfig    
DEBU[0000] validating yamltags of struct Artifact       
DEBU[0000] validating yamltags of struct Sync           
DEBU[0000] validating yamltags of struct SyncRule       
DEBU[0000] validating yamltags of struct SyncRule       
DEBU[0000] validating yamltags of struct SyncRule       
DEBU[0000] validating yamltags of struct SyncRule       
DEBU[0000] validating yamltags of struct SyncRule       
DEBU[0000] validating yamltags of struct SyncRule       
DEBU[0000] validating yamltags of struct ArtifactType   
DEBU[0000] validating yamltags of struct DockerArtifact 
DEBU[0000] validating yamltags of struct TagPolicy      
DEBU[0000] validating yamltags of struct GitTagger      
DEBU[0000] validating yamltags of struct BuildType      
DEBU[0000] validating yamltags of struct LocalBuild     
DEBU[0000] validating yamltags of struct DeployConfig   
DEBU[0000] validating yamltags of struct DeployType     
DEBU[0000] validating yamltags of struct KubectlDeploy  
DEBU[0000] validating yamltags of struct KubectlFlags   
INFO[0000] Using kubectl context: minikube              
DEBU[0000] Using builder: local                         
DEBU[0000] Running command: [minikube docker-env --shell none] 
DEBU[0000] Command output: [DOCKER_TLS_VERIFY=1
DOCKER_HOST=tcp://192.168.39.184:2376
DOCKER_CERT_PATH=/home/eoxdev/.minikube/certs
MINIKUBE_ACTIVE_DOCKERD=minikube
] 
DEBU[0000] setting Docker user agent to skaffold-v1.6.0-docs 
Listing files to watch...
 - client
DEBU[0000] Found dependencies for dockerfile: [{package.json /app true} {. /app true}] 
DEBU[0000] Skipping excluded path: node_modules         
INFO[0000] List generated in 1.684217ms                 
Generating tags...
 - client -&gt; DEBU[0000] Running command: [git describe --tags --always] 
DEBU[0000] Command output: [3403aa6
]                   
DEBU[0000] Running command: [git status . --porcelain]  
DEBU[0000] Command output: []                           
client:3403aa6
INFO[0000] Tags generated in 3.085635ms                 
Checking cache...
DEBU[0000] Found dependencies for dockerfile: [{package.json /app true} {. /app true}] 
DEBU[0000] Skipping excluded path: node_modules         
 - client: Found Locally
INFO[0000] Cache check complete in 6.098469ms           
Tags used in deployment:
 - client -&gt; client:1319b715976becb303bd077717e754e52beaef72d44c7b09f5b6835b1afacae2
   local images can't be referenced by digest. They are tagged and referenced by a unique ID instead
Starting deploy...
DEBU[0000] Running command: [kubectl version --client -ojson] 
DEBU[0000] Command output: [{
  "clientVersion": {
    "major": "1",
    "minor": "18",
    "gitVersion": "v1.18.0",
    "gitCommit": "9e991415386e4cf155a24b1da15becaa390438d8",
    "gitTreeState": "clean",
    "buildDate": "2020-03-25T14:58:59Z",
    "goVersion": "go1.13.8",
    "compiler": "gc",
    "platform": "linux/amd64"
  }
}
] 
DEBU[0000] Running command: [kubectl --context minikube create --dry-run -oyaml -f /home/eoxdev/Projects/issues/skaffold-cra-error/manifests/dev/client.yaml] 
DEBU[0000] Command output: [apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-deployment-dev
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      component: client
  template:
    metadata:
      labels:
        component: client
    spec:
      containers:
      - image: client
        name: client
        ports:
        - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: client-cluster-ip-service-dev
  namespace: default
spec:
  ports:
  - port: 3000
    targetPort: 3000
  selector:
    component: client
  type: ClusterIP
], stderr: W0327 08:49:50.543847   16516 helpers.go:535] --dry-run is deprecated and can be replaced with --dry-run=client. 
DEBU[0000] manifests with tagged images: apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-deployment-dev
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      component: client
  template:
    metadata:
      labels:
        component: client
    spec:
      containers:
      - image: client:1319b715976becb303bd077717e754e52beaef72d44c7b09f5b6835b1afacae2
        name: client
        ports:
        - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: client-cluster-ip-service-dev
  namespace: default
spec:
  ports:
  - port: 3000
    targetPort: 3000
  selector:
    component: client
  type: ClusterIP 
DEBU[0000] manifests with labels apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/managed-by: skaffold-v1.6.0-docs
    skaffold.dev/builder: local
    skaffold.dev/cleanup: "true"
    skaffold.dev/deployer: kubectl
    skaffold.dev/docker-api-version: "1.40"
    skaffold.dev/run-id: 2ee04f07-3f07-4e75-bdba-dfac76d18bf0
    skaffold.dev/tag-policy: git-commit
    skaffold.dev/tail: "true"
  name: client-deployment-dev
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      component: client
  template:
    metadata:
      labels:
        app.kubernetes.io/managed-by: skaffold-v1.6.0-docs
        component: client
        skaffold.dev/builder: local
        skaffold.dev/cleanup: "true"
        skaffold.dev/deployer: kubectl
        skaffold.dev/docker-api-version: "1.40"
        skaffold.dev/run-id: 2ee04f07-3f07-4e75-bdba-dfac76d18bf0
        skaffold.dev/tag-policy: git-commit
        skaffold.dev/tail: "true"
    spec:
      containers:
      - image: client:1319b715976becb303bd077717e754e52beaef72d44c7b09f5b6835b1afacae2
        name: client
        ports:
        - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/managed-by: skaffold-v1.6.0-docs
    skaffold.dev/builder: local
    skaffold.dev/cleanup: "true"
    skaffold.dev/deployer: kubectl
    skaffold.dev/docker-api-version: "1.40"
    skaffold.dev/run-id: 2ee04f07-3f07-4e75-bdba-dfac76d18bf0
    skaffold.dev/tag-policy: git-commit
    skaffold.dev/tail: "true"
  name: client-cluster-ip-service-dev
  namespace: default
spec:
  ports:
  - port: 3000
    targetPort: 3000
  selector:
    component: client
  type: ClusterIP 
DEBU[0000] 2 manifests to deploy. 2 are updated or new  
DEBU[0000] Running command: [kubectl --context minikube apply -f - --force --grace-period=0] 
 - deployment.apps/client-deployment-dev created
 - service/client-cluster-ip-service-dev created
INFO[0000] Deploy complete in 391.276171ms              
Waiting for deployments to stabilize
DEBU[0000] getting client config for kubeContext: ``    
DEBU[0000] checking status default:deployment/client-deployment-dev 
DEBU[0000] Running command: [kubectl --context minikube rollout status deployment client-deployment-dev --namespace default --watch=false] 
DEBU[0000] Command output: [Waiting for deployment "client-deployment-dev" rollout to finish: 0 of 1 updated replicas are available...
] 
DEBU[0001] Running command: [kubectl --context minikube rollout status deployment client-deployment-dev --namespace default --watch=false] 
 - default:deployment/client-deployment-dev Waiting for deployment "client-deployment-dev" rollout to finish: 0 of 1 updated replicas are available...
DEBU[0001] Command output: [Waiting for deployment "client-deployment-dev" rollout to finish: 0 of 1 updated replicas are available...
] 
DEBU[0001] Running command: [kubectl --context minikube rollout status deployment client-deployment-dev --namespace default --watch=false] 
DEBU[0001] Command output: [Waiting for deployment "client-deployment-dev" rollout to finish: 0 of 1 updated replicas are available...
] 
DEBU[0001] Running command: [kubectl --context minikube rollout status deployment client-deployment-dev --namespace default --watch=false] 
DEBU[0001] Command output: [Waiting for deployment "client-deployment-dev" rollout to finish: 0 of 1 updated replicas are available...
] 
DEBU[0001] Running command: [kubectl --context minikube rollout status deployment client-deployment-dev --namespace default --watch=false] 
DEBU[0001] Command output: [Waiting for deployment "client-deployment-dev" rollout to finish: 0 of 1 updated replicas are available...
] 
DEBU[0002] Running command: [kubectl --context minikube rollout status deployment client-deployment-dev --namespace default --watch=false] 
DEBU[0002] Command output: [Waiting for deployment "client-deployment-dev" rollout to finish: 0 of 1 updated replicas are available...
] 
DEBU[0002] Running command: [kubectl --context minikube rollout status deployment client-deployment-dev --namespace default --watch=false] 
DEBU[0002] Command output: [deployment "client-deployment-dev" successfully rolled out
] 
 - default:deployment/client-deployment-dev is ready.
Deployments stabilized in 1.818029816s
DEBU[0002] getting client config for kubeContext: ``    
INFO[0002] Streaming logs from pod: client-deployment-dev-58bdbf5664-fcc7k container: client 
DEBU[0002] Running command: [kubectl --context minikube logs --since=3s -f client-deployment-dev-58bdbf5664-fcc7k -c client --namespace default] 
[client-deployment-dev-58bdbf5664-fcc7k client] 
[client-deployment-dev-58bdbf5664-fcc7k client] &gt; client@0.1.0 start /app
[client-deployment-dev-58bdbf5664-fcc7k client] &gt; react-scripts start
[client-deployment-dev-58bdbf5664-fcc7k client] 
DEBU[0002] Found dependencies for dockerfile: [{package.json /app true} {. /app true}] 
DEBU[0002] Change detected &lt;nil&gt;                        
DEBU[0002] Skipping excluded path: node_modules         
Watching for changes...
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: Project is running at http://172.17.0.8/
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: webpack output is served from 
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: Content not from webpack is served from /app/public
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: 404s will fallback to /
[client-deployment-dev-58bdbf5664-fcc7k client] Starting the development server...
[client-deployment-dev-58bdbf5664-fcc7k client] 
DEBU[0003] Found dependencies for dockerfile: [{package.json /app true} {. /app true}] 
DEBU[0003] Skipping excluded path: node_modules         
INFO[0004] Streaming logs from pod: client-deployment-dev-58bdbf5664-fcc7k container: client 
DEBU[0004] Running command: [kubectl --context minikube logs --since=4s -f client-deployment-dev-58bdbf5664-fcc7k -c client --namespace default] 
[client-deployment-dev-58bdbf5664-fcc7k client] 
[client-deployment-dev-58bdbf5664-fcc7k client] &gt; client@0.1.0 start /app
[client-deployment-dev-58bdbf5664-fcc7k client] &gt; react-scripts start
[client-deployment-dev-58bdbf5664-fcc7k client] 
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: Project is running at http://172.17.0.8/
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: webpack output is served from 
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: Content not from webpack is served from /app/public
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: 404s will fallback to /
[client-deployment-dev-58bdbf5664-fcc7k client] Starting the development server...
[client-deployment-dev-58bdbf5664-fcc7k client] 
INFO[0019] Streaming logs from pod: client-deployment-dev-58bdbf5664-fcc7k container: client 
DEBU[0019] Running command: [kubectl --context minikube logs --since=20s -f client-deployment-dev-58bdbf5664-fcc7k -c client --namespace default] 
[client-deployment-dev-58bdbf5664-fcc7k client] 
[client-deployment-dev-58bdbf5664-fcc7k client] &gt; client@0.1.0 start /app
[client-deployment-dev-58bdbf5664-fcc7k client] &gt; react-scripts start
[client-deployment-dev-58bdbf5664-fcc7k client] 
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: Project is running at http://172.17.0.8/
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: webpack output is served from 
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: Content not from webpack is served from /app/public
[client-deployment-dev-58bdbf5664-fcc7k client] ℹ ｢wds｣: 404s will fallback to /
[client-deployment-dev-58bdbf5664-fcc7k client] Starting the development server...
[client-deployment-dev-58bdbf5664-fcc7k client] 
^CCleaning up...
DEBU[0021] Running command: [kubectl --context minikube create --dry-run -oyaml -f /home/eoxdev/Projects/issues/skaffold-cra-error/manifests/dev/client.yaml] 
DEBU[0021] Command output: [apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-deployment-dev
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      component: client
  template:
    metadata:
      labels:
        component: client
    spec:
      containers:
      - image: client
        name: client
        ports:
        - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: client-cluster-ip-service-dev
  namespace: default
spec:
  ports:
  - port: 3000
    targetPort: 3000
  selector:
    component: client
  type: ClusterIP
], stderr: W0327 08:50:11.709935   16770 helpers.go:535] --dry-run is deprecated and can be replaced with --dry-run=client. 
DEBU[0021] Running command: [kubectl --context minikube delete --ignore-not-found=true -f -] 
 - deployment.apps "client-deployment-dev" deleted
 - service "client-cluster-ip-service-dev" deleted
INFO[0021] Cleanup complete in 187.851194ms  
</code></pre>

<p>I have a test repo here you can try if you'd like:</p>

<p><a href="https://github.com/eox-dev/skaffold-cra-error" rel="nofollow noreferrer">https://github.com/eox-dev/skaffold-cra-error</a></p>

<p>Hopefully this is something I'm just overlooking, but like I've said, I've reverted the app back to when I know it was working and the issue still persists.</p>

<p><strong>EDIT 4/1</strong>
Was hopeful when I read this in the <code>v1.6.0-docs</code> release notes:</p>

<blockquote>
  <p>Note: This release comes with a new config version <code>v2beta1</code>. To upgrade your <code>skaffold.yaml</code>, use <code>skaffold fix</code>. If you choose not to upgrade, <code>skaffold</code> will auto-upgrade as best as it can.</p>
</blockquote>

<p>Still having the same issue, however.</p>

cjones
<p>This is due to a change in <a href="https://github.com/facebook/create-react-app/" rel="noreferrer">facebook/create-react-app</a>, specifically <a href="https://github.com/facebook/create-react-app/issues/8739" rel="noreferrer">#8739</a> and <a href="https://github.com/facebook/create-react-app/issues/8688" rel="noreferrer">#8688</a>.  You'll notice that your container immediately exits from docker if you run without allocating a TTY:</p>

<pre><code>$ docker run --rm client; echo "&gt;&gt; $?"

&gt; client@0.1.0 start /app
&gt; react-scripts start

ℹ ｢wds｣: Project is running at http://172.17.0.4/
ℹ ｢wds｣: webpack output is served from 
ℹ ｢wds｣: Content not from webpack is served from /app/public
ℹ ｢wds｣: 404s will fallback to /
Starting the development server...

&gt;&gt; 0
</code></pre>

<p>There is a workaround posted to the issue, to set <code>CI=true</code> in your Dockerfile:</p>

<pre><code>--- client/Dockerfile.dev
+++ client/Dockerfile.dev
@@ -1,6 +1,7 @@
 FROM node:13-alpine
 WORKDIR /app
 COPY ./package.json ./
+ENV CI=true
 RUN npm install
 COPY . .
</code></pre>
