deploying create-react-app to AWS Elastic Beanstalk

0 votes

I am trying to deploy create-react-app to elastic beanstalk. My deployment is constantly timing out with

ERROR: TimeoutError - The EB CLI timed out after 10 minute(s). The operation might still be running. To keep viewing events, run 'eb events -f'. To set timeout duration, use '--timeout MINUTES'.

I have tried a bunch of different things to get this working. This is my config.yml file

 branch-defaults:
  dev:
    environment: uu-pilot
    group_suffix: null
environment-defaults:
  uu-pilot:
    branch: null
    repository: null
global:
  application_name: uu-pilot
  branch: null
  default_ec2_keyname: null
  default_platform: Node.js
  default_region: ca-central-1
  include_git_submodules: true
  instance_profile: null
  platform_name: null
  platform_version: null
  profile: eb-cli
  repository: null
  sc: git
  workspace_type: Application

my nodecommand.config inside .ebextensions folder:

option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm start"

^^ I have also tried changing the the node command to react-scripts build and react-scripts start

all dependencies are under dependencies and not devDependencies in package.json, and here are my scripts

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

I am getting no particular error message, and am unable to review the exact logs as that operation times out too. I've also added this in case it was just a timeout thing:

option_settings:
- namespace: aws:elasticbeanstalk:command
  option_name: Timeout
  value: 1800

lastly, I deployed a basic node app to see if that would work and it did, so the problem is with the way the create-react-app node server is serving the build folder.

Any direction is appreciated.

Sep 10, 2018 in AWS by bug_seeker
• 15,350 points
1,449 views

1 answer to this question.

0 votes

What you are looking for is eb deploy ... --timeout <minutes>, where <minutes> needs to be the amount of time that you think your application legitimately may take up to be deployed.

It can also be thought of as the number of minutes that the EBCLI must wait for AWS to respond with a success/failure message so that it can stop polling and exit. Until then, the EBCLI will periodically poll AWS. When the EBCLI times out, like it did in your case, it does not translate to a failure in AWS; your operation might still be processing and, as the error message indicates, eb events -f will show its progress.

The timeout in the .ebextensions config file actually refers to the maximum time that AWS (and not the EBCLI) may spend performing the deployment, so changing this will not affect the EBCLI's behaviour in your case.

What I would also recommend is checking out CloudWatch log streaming, using which Beanstalk can send all your logs to CloudWatch. You should be able to access them even after the environment has died, thereby letting to have some visibility into what might have gone wrong. Note that CloudWatch log streaming is a paid service.

answered Sep 10, 2018 by Priyaj
• 56,520 points

Related Questions In AWS

0 votes
1 answer

Deploy react app to AWS with pm2

Under 'tools' directory, in 'distServer.js' try to ...READ MORE

answered Feb 6 in AWS by Fatima
572 views
0 votes
1 answer

AWS Elastic Beanstalk - How to increase instance disk capacity?

The 8 GB diskthat you are seeing ...READ MORE

answered Sep 3, 2018 in AWS by anonymous
188 views
0 votes
1 answer

How to use AWS CLI with Elastic Beanstalk?

You have to create a source bundle ...READ MORE

answered Sep 28, 2018 in AWS by Archana
• 4,090 points
160 views
0 votes
1 answer
0 votes
1 answer

AWS free tier account providing 30GB storage to create an instance

There is no such thing as a ...READ MORE

answered Jul 20, 2018 in AWS by Priyaj
• 56,520 points
54 views