aws-amplify / aws-amplify/amplify-hosting

Cloning repository fails trying to read the cache

Open
#3,228 3 comments 2 reactions 0 assignees View on GitHub
bug frontend-builds investigating
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

### App Id

d31qkmp0h12ar6

### AWS Region

us-west-2

### Amplify Hosting feature

Build settings, Monorepo

### Describe the bug

I'm using a Monorepo configuration for this application and try to make the deploy using a custom amplify.yml file.

Currently the main issue is that the checkout job fails with the following 2 relevant warnings:
```
2023-01-06T12:25:44.542Z [INFO]: # Retrieving environment cache...
2023-01-06T12:25:44.612Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
```

```
2023-01-06T12:26:00.536Z [INFO]: # Retrieving cache...
2023-01-06T12:26:00.536Z [INFO]: # Retrieved cache
2023-01-06T12:26:40.089Z [ERROR]: !!! TypeError: m.indexOf is not a function
2023-01-06T12:26:40.168Z [INFO]: # Starting environment caching...
2023-01-06T12:26:40.168Z [INFO]: # Environment caching completed
```

After that the build step fails.
I've tested the following configuration changes:
- Node 14 & 16
- Overwrite the amplify CLI version (multiple versions and the same as we are using locally)
- Removed the caches from the amplify.yml file declaration
- Removed the test step
- Reconnect the repository multiple times (as is the indication that appears on the interface)

### Expected behavior

We expect to see the checkout to work as expected as the indications are warnings and not errors.

### Reproduction steps

This happens when triggering a build or pushing a new change from gitlab integration.

### Build Settings

_No response_

### Log output

```
2023-01-06T12:25:44.414Z [INFO]: # Switching to commit: 4a5a6f7d9966f36b966e056f491b0948b4bea32a
2023-01-06T12:25:44.458Z [INFO]: Agent pid 159
2023-01-06T12:25:44.458Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
Note: switching to '4a5a6f7d9966f36b966e056f491b0948b4bea32a'.
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 switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 4a5a6f7d9 Testing configuration
2023-01-06T12:25:44.530Z [INFO]: Successfully cleaned up Git credentials
2023-01-06T12:25:44.531Z [INFO]: # Checking for Git submodules at: /codebuild/output/src955501831/src/creator-web/.gitmodules
2023-01-06T12:25:44.542Z [INFO]: # Retrieving environment cache...
2023-01-06T12:25:44.612Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2023-01-06T12:25:44.612Z [INFO]: ---- Setting Up SSM Secrets ----
2023-01-06T12:25:44.612Z [INFO]: SSM params {"Path":"/amplify/d35m6bal8x8kl9/citesting/","WithDecryption":true}
2023-01-06T12:25:44.666Z [INFO]: # Defaulting to Node version 16
2023-01-06T12:25:54.411Z [INFO]: # Node version 16 is available for installation
2023-01-06T12:25:54.502Z [INFO]: # Installing Node version 16
2023-01-06T12:26:00.450Z [INFO]: # Now using Node version 16
2023-01-06T12:26:00.531Z [INFO]: No live updates for this build run
2023-01-06T12:26:00.536Z [INFO]: # Retrieving cache...
2023-01-06T12:26:00.536Z [INFO]: # Retrieved cache
2023-01-06T12:26:40.089Z [ERROR]: !!! TypeError: m.indexOf is not a function
2023-01-06T12:26:40.168Z [INFO]: # Starting environment caching...
2023-01-06T12:26:40.168Z [INFO]: # Environment caching completed
Terminating logging...
```

### Additional information

This application is configured on the amplify console to use other application backend.

Contributor guide

Open the contributing guide

Research direction

Start with the checkout job and the cache-related log entries, especially the 404 while retrieving the environment cache and the subsequent TypeError: m.indexOf is not a function. Review the custom amplify.yml and the GitLab-triggered build configuration mentioned in the report. Done means the repository checkout completes and the build proceeds without the cache-related failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, git, node.js
Domain
ci-cd, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.