Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug react-scripts hanging?

I'm deploying the create-react-app using docker on AWS ECS. I'm testing using dockerhub image that's pretty much the stock version of create-react-app. When launch the task, it's able to pull the container image, launch the docker container, however it hangs on running react-scripts start. All I can see in the container logs are:

01:51:38 npm info it worked if it ends with ok
01:51:38 npm info using [email protected]
01:51:38 npm info using [email protected]
01:51:42 npm info prestart [email protected]
01:51:42 npm info start [email protected]
01:51:42 > [email protected] start /usr/src/app
01:51:42 > react-scripts start
01:52:06 Starting the development server...

It just hangs there and never finishes. However, when I manually run the docker container, everything works fine:

Starting the development server...
Compiled successfully!

The app is running at:

  http://localhost:3000/

My Dockerfile is:

FROM node:4-onbuild

# Prepare app directory
RUN mkdir -p /usr/src/app
ADD . /usr/src/app

# Install dependencies
WORKDIR /usr/src/app
RUN npm install

# Build the app
RUN npm build

# Expose the app port
EXPOSE 3000

# Start the app
CMD npm start --loglevel debug

My package.json:

    "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      "test": "react-scripts test --env=jsdom",
      "eject": "react-scripts eject"
    }
  }

Looking for advice on how to debug or if there's additional logging I can do, thanks!

like image 209
Rob Avatar asked Feb 07 '17 02:02

Rob


1 Answers

I figured it out - when I created defined the container in the ECS task, I didn't allocate enough memory to the docker container so when it was starting the server it ran out of memory and froze up. I changed the settings to allocate more memory to the docker container and now everything works.

like image 127
Rob Avatar answered Nov 06 '22 13:11

Rob