How to Deploy an Express application to Elastic Beanstalk?

0

Greetings,

i followed the following guide https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html

up to creating the sample application, the guide is working

After following the steps at "Update the application to use Express" section. The deployment of the application is failing without providing a reason why it failed.

EB Event Log

Other than reporting timeout, it does not mention what caused the timeout. it also did not matter if the command timeout was set to 2 minutes or 15 minutes, it would fail on a timeout at some point.

After this, the environment would revert back to the sample application instead of the newly deployed version.

i am new to this, so i do not know what logs would contain the reason for timeout. i tried looking at the logs using EB SSH going to /var/log path, but nothing stood out to me. included logs just in case someone with more knowledge spots something

Here is the provided log for the eb init system log, here it looks like to was uploaded correctly and it does detect the package.json

Here is the package.json that was generated using the guide. package.json

2023/06/28 07:57:16.078127 [INFO] Starting...
2023/06/28 07:57:16.078172 [INFO] Starting EBPlatform-PlatformEngine
2023/06/28 07:57:16.078247 [INFO] reading event message file
2023/06/28 07:57:16.078415 [INFO] Engine received EB command userdata-exec

2023/06/28 07:57:16.495456 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:270933161400:stack/awseb-e-jnq4xdpiib-stack/5a450160-14d7-11ee-8be3-0a47f5e773a1 -r AWSEBAutoScalingGroup --region us-east-1
2023/06/28 07:57:17.095756 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:270933161400:stack/awseb-e-jnq4xdpiib-stack/5a450160-14d7-11ee-8be3-0a47f5e773a1 -r AWSEBBeanstalkMetadata --region us-east-1
2023/06/28 07:57:17.445445 [INFO] Unable to ping launch url, this is a scale-up instance.
2023/06/28 07:57:17.445541 [INFO] Engine command: (self-startup)

2023/06/28 07:57:17.445550 [INFO] Downloading EB Application...
2023/06/28 07:57:17.445553 [INFO] Region: us-east-1
2023/06/28 07:57:17.445557 [INFO] envID: e-jnq4xdpiib
2023/06/28 07:57:17.445560 [INFO] envBucket: elasticbeanstalk-us-east-1-270933161400
2023/06/28 07:57:17.445563 [INFO] Using manifest file name from command request
2023/06/28 07:57:17.445575 [INFO] Unable to get version manifest file.
2023/06/28 07:57:17.445577 [INFO] Downloading latest manifest available.
2023/06/28 07:57:17.445579 [INFO] Download latest app version manifest
2023/06/28 07:57:17.445653 [INFO] resources/environments/e-jnq4xdpiib/_runtime/versions/manifest
2023/06/28 07:57:17.503750 [INFO] latestManifest key *: resources/environments/e-jnq4xdpiib/_runtime/versions/manifest_1687938989504

2023/06/28 07:57:17.503892 [INFO] Downloading: bucket: elasticbeanstalk-us-east-1-270933161400, object: /resources/environments/e-jnq4xdpiib/_runtime/versions/manifest_1687938989504
2023/06/28 07:57:17.518274 [INFO] Download successful137bytes downloaded
2023/06/28 07:57:17.518360 [INFO] Trying to read and parse version manifest...
2023/06/28 07:57:17.518423 [INFO] Downloading: bucket: elasticbeanstalk-us-east-1-270933161400, object: /resources/environments/e-jnq4xdpiib/_runtime/_versions/portal2/Sample Application
2023/06/28 07:57:17.539364 [INFO] Download successful2657bytes downloaded
2023/06/28 07:57:17.539484 [INFO] Executing instruction: SyncClock
2023/06/28 07:57:17.539488 [INFO] Starting SyncClock
2023/06/28 07:57:17.539499 [INFO] Running command /bin/sh -c /usr/bin/chronyc tracking
2023/06/28 07:57:17.546940 [INFO] Reference ID    : A9FEA97B (169.254.169.123)
Stratum         : 4
Ref time (UTC)  : Wed Jun 28 07:57:17 2023
System time     : 0.783528090 seconds slow of NTP time
Last offset     : -0.000014643 seconds
RMS offset      : 0.000014643 seconds
Frequency       : 1.971 ppm slow
Residual freq   : -65.756 ppm
Skew            : 0.291 ppm
Root delay      : 0.000441467 seconds
Root dispersion : 0.000347433 seconds
Update interval : 2.0 seconds
Leap status     : Normal

2023/06/28 07:57:17.546981 [INFO] Running command /bin/sh -c /usr/bin/chronyc -a makestep
2023/06/28 07:57:18.332936 [INFO] 200 OK

2023/06/28 07:57:18.345840 [INFO] Skipping Configure OS
2023/06/28 07:57:18.345870 [INFO] Skipping LockRepo
2023/06/28 07:57:18.345875 [INFO] Skipping GenerateEBBanner
2023/06/28 07:57:18.345879 [INFO] Skipping Install Process Manager
2023/06/28 07:57:18.345897 [INFO] Skipping install syslog
2023/06/28 07:57:18.345900 [INFO] Skipping install cron
2023/06/28 07:57:18.345904 [INFO] Skipping install proxy
2023/06/28 07:57:18.345908 [INFO] Skipping installhealthd
2023/06/28 07:57:18.345911 [INFO] Skipping Install Log Streaming Manager
2023/06/28 07:57:18.345915 [INFO] Skipping install X-Ray
2023/06/28 07:57:18.345919 [INFO] Skipping install Third Party License
2023/06/28 07:57:18.345922 [INFO] Skipping install httpd
2023/06/28 07:57:18.345929 [INFO] Instance has NOT been bootstrapped
2023/06/28 07:57:18.345931 [INFO] Executing instruction: installSqsd
2023/06/28 07:57:18.345934 [INFO] This is a web server environment instance, skip install sqsd daemon ...
2023/06/28 07:57:18.345945 [INFO] Instance has NOT been bootstrapped
2023/06/28 07:57:18.345948 [INFO] Executing instruction: bootstraphealthd
2023/06/28 07:57:18.345951 [INFO] this is a basic health env, skip bootstrap healthd instruction...
2023/06/28 07:57:18.345953 [INFO] Executing instruction: GetSetupProxyLog
2023/06/28 07:57:18.346036 [INFO] Skipping Install yum packages
2023/06/28 07:57:18.346041 [INFO] Skipping Install default nodejs
2023/06/28 07:57:18.346044 [INFO] Skipping MarkBaked
2023/06/28 07:57:18.346048 [INFO] Instance has NOT been bootstrapped
2023/06/28 07:57:18.346051 [INFO] Executing instruction: TuneSystemSettings
2023/06/28 07:57:18.346053 [INFO] Starting TuneSystemSettings
2023/06/28 07:57:18.346057 [INFO] Instance has NOT been bootstrapped
2023/06/28 07:57:18.346922 [INFO] Executing instruction: GetSetupLogRotate
2023/06/28 07:57:18.346927 [INFO] Initialize LogRotate files and directories
2023/06/28 07:57:18.363781 [INFO] Instance has NOT been bootstrapped
2023/06/28 07:57:18.363789 [INFO] Executing instruction: BootstrapCFNHup
2023/06/28 07:57:18.363792 [INFO] Bootstrap cfn-hup
2023/06/28 07:57:18.365671 [INFO] Copying file /opt/elasticbeanstalk/config/private/aws-eb-command-handler.conf to /etc/cfn/hooks.d/aws-eb-command-handler.conf
2023/06/28 07:57:18.367009 [INFO] Executing instruction: StartCFNHup
2023/06/28 07:57:18.367014 [INFO] Start cfn-hup
2023/06/28 07:57:18.367028 [INFO] Running command /bin/sh -c systemctl show -p PartOf cfn-hup.service
2023/06/28 07:57:18.373213 [INFO] cfn-hup is not registered with EB yet, registering it now
2023/06/28 07:57:18.373231 [INFO] Running command /bin/sh -c systemctl show -p PartOf cfn-hup.service
2023/06/28 07:57:18.378856 [INFO] Running command /bin/sh -c systemctl daemon-reload
2023/06/28 07:57:18.427058 [INFO] Running command /bin/sh -c systemctl reset-failed
2023/06/28 07:57:18.430862 [INFO] Running command /bin/sh -c systemctl is-enabled aws-eb.target
2023/06/28 07:57:18.434851 [INFO] Running command /bin/sh -c systemctl enable aws-eb.target
2023/06/28 07:57:18.489451 [INFO] Running command /bin/sh -c systemctl start aws-eb.target
2023/06/28 07:57:18.495730 [INFO] Running command /bin/sh -c systemctl enable cfn-hup.service
2023/06/28 07:57:18.693507 [INFO] Created symlink from /etc/systemd/system/multi-user.target.wants/cfn-hup.service to /etc/systemd/system/cfn-hup.service.

2023/06/28 07:57:18.693538 [INFO] Running command /bin/sh -c systemctl is-active cfn-hup.service
2023/06/28 07:57:18.697556 [INFO] cfn-hup process is not running, starting it now
2023/06/28 07:57:18.697583 [INFO] Running command /bin/sh -c systemctl show -p PartOf cfn-hup.service
2023/06/28 07:57:18.702040 [INFO] Running command /bin/sh -c systemctl is-active cfn-hup.service
2023/06/28 07:57:18.705215 [INFO] Running command /bin/sh -c systemctl start cfn-hup.service
2023/06/28 07:57:18.745879 [INFO] Instance has NOT been bootstrapped
2023/06/28 07:57:18.745896 [INFO] Executing instruction: SetupPublishLogCronjob
2023/06/28 07:57:18.745900 [INFO] Setup publish logs cron job...
2023/06/28 07:57:18.745905 [INFO] Copying file /opt/elasticbeanstalk/config/private/logtasks/cron/publishlogs to /etc/cron.d/publishlogs
2023/06/28 07:57:18.749351 [INFO] Instance has NOT been bootstrapped
2023/06/28 07:57:18.749364 [INFO] Executing instruction: MarkBootstrapped
2023/06/28 07:57:18.749368 [INFO] Starting MarkBootstrapped
2023/06/28 07:57:18.749373 [INFO] Instance has NOT been bootstrapped
2023/06/28 07:57:18.749426 [INFO] Marked instance as Bootstrapped
2023/06/28 07:57:18.749430 [INFO] Executing instruction: Save CFN Stack Info
2023/06/28 07:57:18.749469 [INFO] Starting SwitchCFNStack
2023/06/28 07:57:18.749474 [INFO] Executing instruction: stopSqsd
2023/06/28 07:57:18.749478 [INFO] This is a web server environment instance, skip stop sqsd daemon ...
2023/06/28 07:57:18.749481 [INFO] Executing instruction: PreBuildEbExtension
2023/06/28 07:57:18.749485 [INFO] Starting executing the config set Infra-EmbeddedPreBuild.
2023/06/28 07:57:18.749499 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:us-east-1:270933161400:stack/awseb-e-jnq4xdpiib-stack/5a450160-14d7-11ee-8be3-0a47f5e773a1 -r AWSEBAutoScalingGroup --region us-east-1 --configsets Infra-EmbeddedPreBuild
2023/06/28 07:57:19.225546 [INFO] Finished executing the config set Infra-EmbeddedPreBuild.

2023/06/28 07:57:19.225565 [INFO] Executing instruction: StageApplication
2023/06/28 07:57:19.225681 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2023/06/28 07:57:19.225695 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2023/06/28 07:57:19.228454 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2023/06/28 07:57:19.228906 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2023/06/28 07:57:19.228944 [INFO] Executing platform hooks in .platform/hooks/prebuild/
2023/06/28 07:57:19.228956 [INFO] The dir .platform/hooks/prebuild/ does not exist
2023/06/28 07:57:19.228959 [INFO] Finished running scripts in /var/app/staging/.platform/hooks/prebuild
2023/06/28 07:57:19.228963 [INFO] Executing instruction: Install customer specified node.js version
2023/06/28 07:57:19.228965 [INFO] installing specified nodejs version...
2023/06/28 07:57:19.229036 [INFO] there is no nodejs version specified in package.json, skip installing specified version of nodejs
2023/06/28 07:57:19.229042 [INFO] Executing instruction: Use NPM to install dependencies
2023/06/28 07:57:19.229051 [INFO] use npm to install dependencies
2023/06/28 07:57:19.229058 [INFO] Getting npm verison
2023/06/28 07:57:19.229065 [INFO] Running command /bin/sh -c npm --version
2023/06/28 07:57:20.280089 [INFO] 9.5.1

2023/06/28 07:57:20.280105 [INFO] Using npm v9
2023/06/28 07:57:20.280118 [INFO] Running command /bin/su webapp -c npm --omit=dev install
2023/06/28 07:57:20.837421 [INFO]
up to date, audited 1 package in 141ms

found 0 vulnerabilities

2023/06/28 07:57:20.837475 [INFO] Running command /bin/su webapp -c npm --omit=dev rebuild
2023/06/28 07:57:21.320876 [INFO] rebuilt dependencies successfully

2023/06/28 07:57:21.320897 [INFO] Executing instruction: check Procfile
2023/06/28 07:57:21.320901 [INFO] checking Procfile
2023/06/28 07:57:21.320921 [INFO] no Procfile found, generating Procfile
2023/06/28 07:57:21.320924 [INFO] checking package.json file
2023/06/28 07:57:21.320932 [INFO] found package.json file, using npm to start application
2023/06/28 07:57:21.321034 [INFO] Executing instruction: configure X-Ray
2023/06/28 07:57:21.321039 [INFO] X-Ray is not enabled.
2023/06/28 07:57:21.321042 [INFO] Executing instruction: configure proxy server
2023/06/28 07:57:21.333666 [INFO] Executing instruction: configure healthd specific proxy conf
2023/06/28 07:57:21.333675 [INFO] this env is basic health, skip copy healthd related proxy conf...
2023/06/28 07:57:21.333678 [INFO] Executing instruction: configure log streaming
2023/06/28 07:57:21.333681 [INFO] log streaming is not enabled
2023/06/28 07:57:21.333684 [INFO] disable log stream
2023/06/28 07:57:21.333697 [INFO] Running command /bin/sh -c systemctl show -p PartOf amazon-cloudwatch-agent.service
2023/06/28 07:57:21.340850 [INFO] Running command /bin/sh -c systemctl stop amazon-cloudwatch-agent.service
2023/06/28 07:57:21.345624 [INFO] Executing instruction: GetToggleForceRotate
2023/06/28 07:57:21.345640 [INFO] Checking if logs need forced rotation
2023/06/28 07:57:21.345653 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:270933161400:stack/awseb-e-jnq4xdpiib-stack/5a450160-14d7-11ee-8be3-0a47f5e773a1 -r AWSEBAutoScalingGroup --region us-east-1
2023/06/28 07:57:21.632221 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-1:270933161400:stack/awseb-e-jnq4xdpiib-stack/5a450160-14d7-11ee-8be3-0a47f5e773a1 -r AWSEBBeanstalkMetadata --region us-east-1
2023/06/28 07:57:21.930249 [INFO] Generating rsyslog config from Procfile
2023/06/28 07:57:21.931859 [INFO] Running command /bin/sh -c systemctl restart rsyslog.service
2023/06/28 07:57:21.955221 [INFO] Executing instruction: PostBuildEbExtension
2023/06/28 07:57:21.955239 [INFO] Starting executing the config set Infra-EmbeddedPostBuild.
2023/06/28 07:57:21.955255 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:us-east-1:270933161400:stack/awseb-e-jnq4xdpiib-stack/5a450160-14d7-11ee-8be3-0a47f5e773a1 -r AWSEBAutoScalingGroup --region us-east-1 --configsets Infra-EmbeddedPostBuild
2023/06/28 07:57:22.482082 [INFO] Finished executing the config set Infra-EmbeddedPostBuild.

2023/06/28 07:57:22.482102 [INFO] Executing instruction: CleanEbExtensions
2023/06/28 07:57:22.482988 [INFO] Cleaned ebextensions subdirectories from app staging directory.
2023/06/28 07:57:22.482994 [INFO] Executing instruction: RunAppDeployPreDeployHooks
2023/06/28 07:57:22.483004 [INFO] Executing platform hooks in .platform/hooks/predeploy/
2023/06/28 07:57:22.483015 [INFO] The dir .platform/hooks/predeploy/ does not exist
2023/06/28 07:57:22.483018 [INFO] Finished running scripts in /var/app/staging/.platform/hooks/predeploy
2023/06/28 07:57:22.483022 [INFO] Executing instruction: stop X-Ray
2023/06/28 07:57:22.483024 [INFO] stop X-Ray ...
2023/06/28 07:57:22.483034 [INFO] Running command /bin/sh -c systemctl show -p PartOf xray.service
2023/06/28 07:57:22.490248 [WARN] stopProcess Warning: process xray 
stephan
asked 10 months ago235 views
1 Answer
0
Accepted Answer

So to answer my own question. for some reason its not working because of enhanced monitoring. i ended follow this guide that did work for me: https://www.freecodecamp.org/news/how-to-use-elastic-beanstalk-to-deploy-node-js-app/

stephan
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions