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.

If you need to know more about React, Its recommended to join React Certification Course today.

Sep 10, 2018 in AWS by bug_seeker
• 15,510 points
6,991 views
  1. Install AWS Elastic Beanstalk CLI. 
  2. In your Cloud9 IDE environment, navigate to "aws-elasticbeanstalk-fullstack-webapp/userreg-react-beanstalk" .
  3. Initialize Elastic Beanstalk application in your AWS Account in the selected region. 
  4. Select the Appropriate Region and Application Name. (Please ensure that you select the region that you chose in previous steps)

    Enter "Y" for Node.js question and select the platform branch.

    You could opt No for CodeCommit and either create or select an existing key pair for SSH.

  5. Once the application is initialized, run the below command in the terminal

  6. Once the environment is created and EB CLI responds with success, Go to Elastic Beanstalk environments  and select userreg-react* environment → Click Go to environment.

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.

Hope it helps!

If you need to know more about React, Its recommended to join React certification course today.

Thank You!!

answered Sep 10, 2018 by Priyaj
• 58,020 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, 2019 in AWS by Fatima
2,616 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
3,982 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,170 points
2,201 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
• 58,020 points
2,015 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP