Describe the bug
The builds were working just fine and suddenly started to fail in the "Cloning repository" activity.
This is the log:
2019-09-09T16:55:37.647Z [INFO]: Git SSH Key acquired
2019-09-09T16:55:37.746Z [INFO]: # Cloning repository: [email protected]:xxxxxxx
2019-09-09T16:55:37.862Z [INFO]: Agent pid 70
2019-09-09T16:55:37.869Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2019-09-09T16:55:37.922Z [INFO]: Cloning into 'vue-frontend'...
2019-09-09T16:55:38.025Z [INFO]: Warning: Permanently added the ECDSA host key for IP address 'xxx.xxx.xxx.xxx' to the list of known hosts.
2019-09-09T16:55:38.771Z [INFO]: # Checking for Git submodules at: /codebuild/output/src337110790/src/vue-frontend/.gitmodules
2019-09-09T16:55:38.800Z [INFO]: # Retrieving cache...
2019-09-09T16:55:38.846Z [INFO]: # Extracting cache...
2019-09-09T16:55:38.855Z [INFO]: # Extraction completed
2019-09-09T16:55:38.856Z [INFO]: # Retrieving environment cache...
2019-09-09T16:55:38.889Z [INFO]: # Retrieved environment cache
2019-09-09T16:55:38.968Z [WARNING]: ! Unable to patch packages...
2019-09-09T16:55:38.981Z [ERROR]: !!! TypeError: Cannot read property 'indexOf' of null
2019-09-09T16:55:38.981Z [INFO]: # Starting environment caching...
2019-09-09T16:55:38.982Z [INFO]: # Environment caching completed
Terminating logging...
To Reproduce
(Re)execute a build in the AWS Console.
Additional context
build activity, but helps to discard any code related issue)detached from HEAD message (from earlier builds) but now the message is gone and keeps failing.Edit1:
node:latest) and fails with the same log.We're getting the exact same error on our github hosted repo.
Also the error( in the cloning repository step) is sometimes:
2019-09-10T08:51:43.646Z [ERROR]: !!! TypeError: undefined is not a function
@dobo-cc @tianmarin we are looking at this as the highest priority. Can you please share your appid? Found in App settings > General
Hey @swaminator! Thanks for looking into it. Ours is apps/d1q08he2j3wck8.
thank you @swaminator !
Our failing apps are:
Hey @tianmarin, are you using an amplify.yml in your repositories? If so could you please share one of them?
If you aren't comfortable sharing publicly, please email [email protected] with the file
Thanks!
Thank you @anatonie !
I have been playing around with it since the bug was presented, this is the final version.
amplify.yml
version: 0.1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
build:
commands:
- npm cache clean
- #npm cache clean --force
- #rm -rf node_modules && rm package-lock.json && npm install
- #npm install --global vue-cli
- npm install
- npm run build
artifacts:
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*
So right now you are passing null commands in the build phase:
commands:
- # comment
This isn't a valid command, and is causing the issue, but the service isn't properly reporting the issue (we are working on this).
To fix this and retain your comments, You can format like this:
commands:
- some command
# - some commented command
@dobo-cc you're having a similar issue with YML formatting, you have a line that includes a colon (:). YML uses colons as an indicator so this is causing issues, and like above, the service is not properly reporting this.
You can wrap you command in quotes to correct this:
commands:
- "some command with: a colon"
# if you need quotes inside this command, please escape them
- "some command with: a colon and \"quoted text\""
If you guys could please give those a try and report back that'd be much appreciated!
@anatonie you are totally correct!
once those null commands were removed the build process worked without issues.
Note that amplify.ymlmust be updated in the repo. Updating the Build settings in the console will lead to the same error.
@tianmarin I'm glad to hear that sorted it out for you!
And yes, if you have amplify.yml in your repository that takes precedence over the settings in the console.
For all the other folks here who have upvoted the issue, can you check your amplify.yml file?
@anatonie That fixed it - thanks a lot.
Most helpful comment
We're getting the exact same error on our github hosted repo.
Also the error( in the cloning repository step) is sometimes:
2019-09-10T08:51:43.646Z [ERROR]: !!! TypeError: undefined is not a function