NPM Install: Command timed out after 900 seconds on CodeDeploy - reactjs

Not exactly sure what is taking so long for npm to install on my EC2 instance, but here's the log output:
----------------------------------------
/var/log/eb-engine.log
----------------------------------------
2020/10/10 00:43:19.430098 [INFO] Downloading: bucket: elasticbeanstalk-us-east-1-665496786822,object: /resources/environments/e-779g33dt9k/_runtime/versions/manifest_1602290543372
2020/10/10 00:43:19.636192 [INFO] Download successful243bytes downloaded
2020/10/10 00:43:19.636422 [INFO] Trying to read and parse version manifest...
2020/10/10 00:43:19.636595 [INFO] Executing instruction: stopSqsd
2020/10/10 00:43:19.636602 [INFO] This is a web server environment instance, skip stop sqsd daemon...
2020/10/10 00:43:19.636606 [INFO] Executing instruction: StageApplication
2020/10/10 00:44:03.357499 [INFO] extracting
/opt/elasticbeanstalk/deployment/app_source_bundleto/var/app/staging/
2020/10/10 00:44:03.357569 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o
/opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2020/10/10 00:44:03.972792 [INFO] finished extracting
/opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2020/10/10 00:44:03.973892 [INFO] Executing instruction: RunConfigDeployPreBuildHooks
2020/10/10 00:44:03.973905 [WARN] skipping hooks scripts under /opt/elasticbeanstalk/hooks/
2020/10/10 00:44:03.973917 [INFO] The dir .platform/confighooks/prebuild/ does not exist in the
application. Skipping this step...
2020/10/10 00:44:03.973922 [INFO] Executing instruction: Install customer specified node.js version
2020/10/10 00:44:03.973927 [INFO] installing specified nodejs version...
2020/10/10 00:44:03.974861 [INFO] validate the node.js version specified by customer...
2020/10/10 00:44:03.974877 [INFO] Nodejs 12.16.1 has already been installed, skipping
2020/10/10 00:44:03.974882 [INFO] Executing instruction: Use NPM to install dependencies
2020/10/10 00:44:03.974895 [INFO] use npm to install dependencies
2020/10/10 00:44:03.974932 [INFO] Running command /bin/sh -c npm config set jobs 1
2020/10/10 00:44:10.557446 [INFO] Running command /bin/sh -c npm --production install
2020/10/10 00:59:11.436998 [ERROR] An error occurred during execution of command [config-deploy] -
[Use NPM to install dependencies]. Stop running the command. Error: Command /bin/sh -c npm --
production install failed with error Command timed out after 900 seconds
I'm using the full CodePipeline, here is my buildspec.yml (spacing abbreviated):
# Buildspec version
version: 0.2
frontend:
phases:
preBuild:
commands:
- echo Installing NPM dependencies...
- npm ci
build:
commands:
- npm run-script build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
This should output a directory build for CodeDeploy, which uses this appspec.yml:
version: 0.0
os: linux
files:
- source: /
destination: /var/app/current

Turns out that Beanstalk likes to try to do things its own way, and I have it set to the Nodejs platform so it is going to try to run npm install and npm start at all costs.
I ended up disabling it through not including my package.json or package lock files in CodeBuild's artifact. This at least stopped it from trying to run its own NPM install. Not exactly efficient and I port all my node_modules over but it is zipped as an artifact from CodeBuild and sent to Beanstalk for deployment.

Related

Deploying react app with craco on aws amplify

I have a blocking issue since days
I tried to deploy this repo on aws amplify and the build fail:
https://github.com/metaplex-foundation/candy-machine-ui
Everything works perfect in local (yarn run dev and yarn run build)
But with amplify:
here the error
2023-01-24T15:12:12.674Z [INFO]: # Executing command: yarn run build
2023-01-24T15:12:12.803Z [INFO]: yarn run v1.22.0
2023-01-24T15:12:12.826Z [INFO]: $ craco build
2023-01-24T15:12:17.161Z [INFO]: Creating an optimized production build...
2023-01-24T15:13:44.769Z [INFO]: Failed to compile.
2023-01-24T15:13:44.771Z [INFO]: Failed to load config "react-app" to extend from.
Referenced from: /codebuild/output/src254071763/src/fake-mint/package.json
2023-01-24T15:13:44.772Z [INFO]:
2023-01-24T15:13:44.847Z [WARNING]: error Command failed with exit code 1.
2023-01-24T15:13:44.848Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2023-01-24T15:13:44.852Z [ERROR]: !!! Build failed
2023-01-24T15:13:44.853Z [ERROR]: !!! Non-Zero Exit Code detected
2023-01-24T15:13:44.853Z [INFO]: # Starting environment caching...
2023-01-24T15:13:44.853Z [INFO]: # Environment caching completed

AWS Amplify React - Deployment and Authentication No Longer Working

I have a React application that I deployed to AWS Amplify which has been working just fine. I deployed the application in September of this year, and decided to make a minor HTML update yesterday. I tried to re-deploy the application but I am facing two issues: (1) First, I keep getting an error in the deployment process. You can see the end of the log of the error below:
...
...
2022-12-23T12:45:48.274Z [INFO]: npm ERR! code 127
2022-12-23T12:45:48.277Z [INFO]: npm ERR! path
/root/.nvm/versions/node/v16.19.0/lib/node_modules/#aws-amplify/cli/node_modules/babel-runtime/node_modules/core-js
npm ERR! command failed
npm ERR! command sh -c -- node -e "try{require('./postinstall')}catch(e){}"
npm ERR! sh: node: command not found
2022-12-23T12:45:48.277Z [INFO]: npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-12-23T12_42_58_395Z-debug-0.log
2022-12-23T12:45:48.340Z [WARNING]: Process exited with exit code: 127
2022-12-23T12:45:48.340Z [INFO]: ! Error patching NPM package '#aws-amplify/cli' to version 7.6.19
2022-12-23T12:45:48.346Z [INFO]: # Retrieving cache...
2022-12-23T12:45:55.639Z [INFO]: # Extracting cache...
2022-12-23T12:46:05.281Z [INFO]: # Extraction completed
2022-12-23T12:46:05.469Z [INFO]: # Retrieved cache
2022-12-23T12:46:38.486Z [INFO]: ## Starting Backend Build
# Starting phase: build
## Running amplify pull to generate aws-exports.js file for frontend
2022-12-23T12:46:43.354Z [INFO]: [31mInvalid feature flag configuration[39m
2022-12-23T12:46:43.356Z [INFO]: [31mThese feature flags are defined in the "amplify/cli.json" configuration file and are unknown to the currently running Amplify CLI:[39m
[31m - graphqltransformer.showfieldauthnotification[39m
[31mThis issue likely happens when the project has been pushed with a newer version of Amplify CLI, try updating to a newer version.[39m
[31mEnsure that the CI/CD pipeline is not using an older or pinned down version of Amplify CLI.[39m
[31mLearn more about feature flags: https://docs.amplify.aws/cli/reference/feature-flags[39m
2022-12-23T12:46:43.373Z [ERROR]: !!! Build failed
2022-12-23T12:46:43.373Z [ERROR]: !!! Non-Zero Exit Code detected
2022-12-23T12:46:43.373Z [INFO]: # Starting environment caching...
2022-12-23T12:46:43.374Z [INFO]: # Uploading environment cache artifact...
2022-12-23T12:46:43.486Z [INFO]: # Uploaded environment cache artifact
2022-12-23T12:46:43.487Z [INFO]: # Environment caching completed
Terminating logging...
...I tried to (1) delete node_modules, and run npm install again, but that was not successful. I noticed that the most recent aws-amplify/cli is a higher version than the one I am using, but I set the 7.6.19 version in the Build parameters in AWS, so I can't imagine that this is the issue. I upgraded the local cli to the current version, but that did not make a difference either.
The (2) second issue I am facing is that user authentication is no longer working when I run the application locally on my machine. I even reverted back to the commit that was working, and even that is not able to allow users to login. Keep in mind the version in production is just fine (and its the same version as the commit I tried locally).
My question is: What do these errors have in common, and can you suggest a path forward to address this?

AWS codebuild fails stating the error:- COMMAND_EXECUTION_ERROR: Error while executing command: yarn run build. Reason: exit status 1

I am trying to aws codebuild for creating ci/cd pipeline. I have used yarn as package manager. Here is my buildspec file.
# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
version: 0.2
phases:
install:
commands:
- echo update npm...
- npm install -g n
- n latest
- npm update -g npm
- echo node -v
- node -v
- echo npm -v
- npm -v
- echo install yarn...
- npm install -g yarn
- echo yarn -v
- yarn -v
pre_build:
commands:
#installs dependencies into the node_modules/ directory
- echo Entered the pre_build phase...
- yarn install
build:
commands:
- echo Build started on `date`
- echo Compiling
- yarn run build
post_build:
commands:
- echo Build completed on `date`
# Include only the files required for your application to run.
artifacts:
files:
- public/**/*
- src/**/*
- package.json
- appspec.yml
- scripts/**/*
PS: Here for some reason by writing only yarn is not working in prebuild phase. But now its showing error in build phase.
COMMAND_EXECUTION_ERROR: Error while executing command: yarn run build. Reason: exit
status 1
As I am new to aws I am unable to find solution. Please help me in this if possible.
Thank you

Why does AWS-Amplify build fails when Auth feature is added

I just recently started using Amazon's AWS basic plan, I am using the AWS-Amplify for uploading react applications and I usually used yarn with create react-app. I am not sure if it has conflicts with the AWS tutorial using npm but I got it right and had success with the building and deployment. However, when I added the Auth functionalities it only worked on my local but the build fails on deployment. This is the error log:
2020-06-23T17:07:34.078Z [INFO]: Git SSH Key acquired
2020-06-23T17:07:34.155Z [INFO]: # Cloning repository: git#github.com:mav1283/amplifyapp.git
2020-06-23T17:07:34.273Z [INFO]: Agent pid 131
2020-06-23T17:07:34.329Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2020-06-23T17:07:34.558Z [INFO]: Cloning into 'amplifyapp'...
2020-06-23T17:07:35.697Z [INFO]: Warning: Permanently added the RSA host key for IP address '13.229.188.59' to the list of known hosts.
2020-06-23T17:07:38.298Z [INFO]: # Switching to commit: 2d93cd9fca8f302a1390bce33985acccf97a8263
2020-06-23T17:07:38.388Z [INFO]: Note: checking out '2d93cd9fca8f302a1390bce33985acccf97a8263'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 2d93cd9 add auth
2020-06-23T17:07:38.389Z [INFO]: # Checking for Git submodules at: /codebuild/output/src043707224/src/amplifyapp/.gitmodules
2020-06-23T17:07:38.411Z [INFO]: # Retrieving cache...
2020-06-23T17:07:40.086Z [INFO]: # Extracting cache...
2020-06-23T17:07:43.479Z [INFO]: # Extraction completed
2020-06-23T17:07:43.604Z [INFO]: # Retrieving environment cache...
2020-06-23T17:07:43.642Z [INFO]: # Retrieved environment cache
2020-06-23T17:08:17.476Z [INFO]: ## Starting Frontend Build
# Starting phase: preBuild
# Executing command: yarn install
2020-06-23T17:08:18.203Z [INFO]: yarn install v1.16.0
2020-06-23T17:08:18.305Z [INFO]: [1/4] Resolving packages...
2020-06-23T17:08:18.838Z [INFO]: [2/4] Fetching packages...
2020-06-23T17:08:48.710Z [INFO]: info fsevents#2.1.2: The platform "linux" is incompatible with this module.
2020-06-23T17:08:48.712Z [INFO]: info "fsevents#2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-06-23T17:08:48.719Z [INFO]: info fsevents#1.2.13: The platform "linux" is incompatible with this module.
2020-06-23T17:08:48.723Z [INFO]: info "fsevents#1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents#2.1.3: The platform "linux" is incompatible with this module.
info "fsevents#2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-06-23T17:08:48.728Z [INFO]: [3/4] Linking dependencies...
2020-06-23T17:08:48.732Z [WARNING]: warning "#aws-amplify/ui-react > #aws-amplify/ui-components#0.5.2" has unmet peer dependency "#aws-amplify/auth#^2.1.5".
warning "#aws-amplify/ui-react > #aws-amplify/ui-components#0.5.2" has unmet peer dependency "#aws-amplify/core#^2.2.4".
warning "#aws-amplify/ui-react > #aws-amplify/ui-components#0.5.2" has unmet peer dependency "#aws-amplify/xr#^1.1.5".
warning " > #testing-library/user-event#7.2.1" has unmet peer dependency "#testing-library/dom#>=5".
2020-06-23T17:08:48.734Z [WARNING]: warning "aws-amplify > #aws-amplify/api#3.1.17" has incorrect peer dependency "#aws-amplify/pubsub#^2.1.1".
warning "aws-amplify > #aws-amplify/datastore#2.2.4" has unmet peer dependency "#react-native-community/netinfo#^5.5.0".
warning "aws-amplify > #aws-amplify/api > #aws-amplify/api-graphql#1.1.0" has incorrect peer dependency "#aws-amplify/pubsub#^2.1.1".
2020-06-23T17:08:48.736Z [WARNING]: warning "react-scripts > #typescript-eslint/eslint-plugin > tsutils#3.17.1" has unmet peer dependency "typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
2020-06-23T17:08:56.100Z [INFO]: [4/4] Building fresh packages...
2020-06-23T17:08:57.025Z [INFO]: Done in 38.83s.
2020-06-23T17:08:57.047Z [INFO]: # Completed phase: preBuild
# Starting phase: build
# Executing command: yarn run build
2020-06-23T17:08:57.210Z [INFO]: yarn run v1.16.0
2020-06-23T17:08:57.237Z [INFO]: $ react-scripts build
2020-06-23T17:08:58.125Z [INFO]: Creating an optimized production build...
2020-06-23T17:08:59.577Z [INFO]: Failed to compile.
2020-06-23T17:08:59.579Z [INFO]: ./src/index.js
Cannot find file './aws-exports' in './src'.
2020-06-23T17:08:59.596Z [WARNING]: error Command failed with exit code 1.
2020-06-23T17:08:59.597Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2020-06-23T17:08:59.602Z [ERROR]: !!! Build failed
2020-06-23T17:08:59.677Z [ERROR]: !!! Non-Zero Exit Code detected
2020-06-23T17:08:59.677Z [INFO]: # Starting environment caching...
2020-06-23T17:08:59.678Z [INFO]: # Environment caching completed
Terminating logging...
Creating the service role and changing the CLI version worked for me. If you do one and not the other you will not solve the problem. So create the service role and update the CLi version in the advanced settings to latest. That will work like magic.
For security reasons aws-exports.js is added to git ignore by default on amplify projects. This file is generated when you run the amplify push command.
backend:
phases:
# IMPORTANT - Please verify your build commands
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
Make sure you have amplifyPush --simple on your Build Settings -> amplify.yml file so you generate aws-exports on your amplify builds

Issue while building zeppelin ERROR: spawn npm ENOENT

I am using the following command to build zeppelin 0.8 on ubuntu
mvn clean package -Pbuild-distr -Pyarn -Pspark-1.6
-Dspark.version=1.6.0 -Phadoop-2.6 -Dhadoop.version=2.6.0-cdh5.9.0 -DskipTests -Pvendor-repo
I am getting following error
[WARNING] warning Unmet peer dependency "eslint#>=3.8.1".
[INFO] [4/4] Building fresh packages...
[INFO] $ bower install --silent
[INFO] Done in 77.54s.
[INFO]
[INFO] --- frontend-maven-plugin:1.3:yarn (yarn build) # zeppelin-web ---
[INFO] Running 'yarn run build' in /home/[USER]/zeppelin/zeppelin-web
[INFO] yarn run v0.18.1
[INFO] $ npm-run-all clean
[ERROR] ERROR: spawn npm ENOENT
[ERROR] error Command failed with exit code 1.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
.
[INFO] Zeppelin: web Application ......................... FAILURE [1:20.415s]
[INFO] Zeppelin: Server .................................. SKIPPED
[INFO] Zeppelin: Packaging distribution .................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4:35.974s
[INFO] Finished at: Fri Jan 27 08:44:39 PST 2017
[INFO] Final Memory: 196M/464M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:yarn (yarn build) on project zeppelin-web: Failed to run task: 'yarn run build' failed. (error code 1) -> [Help 1]
[ERROR]
Installing npm on the host resolved the issue for me

Resources