aws-amplify / aws-amplify/amplify-hosting

Slow cache artifact creation and extraction steps

Open
#4,054 0 comments 1 reaction 0 assignees View on GitHub
console pending-triage
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Environment information

```plain text
N/A
```

### Describe the bug

When I enabled caching for a nuxt project that uses pnpm, I noticed that my build duration more than doubled. From the logs I was able to observe that both artifact creation and artifact extraction are very slow (over 90 seconds each).
```
2025-05-14T12:33:44.149Z [INFO]: # Retrieving cache...
2025-05-14T12:34:24.982Z [INFO]: # Extracting cache...
2025-05-14T12:36:19.029Z [INFO]: # Extraction completed
2025-05-14T12:36:19.492Z [INFO]: # Retrieved cache
```
```
2025-05-14T12:38:58.931Z [INFO]: # Starting caching...
2025-05-14T12:38:58.938Z [INFO]: # Creating cache artifact...
2025-05-14T12:40:19.975Z [INFO]: # Created cache artifact
2025-05-14T12:40:20.074Z [INFO]: # Uploading cache artifact...
2025-05-14T12:40:48.060Z [INFO]: # Uploaded cache artifact
2025-05-14T12:40:48.152Z [INFO]: # Caching completed
```
When performing a fresh install locally, my node_modules is 785MBs

### Reproduction steps

Here's my build configuration. I'm also in the eu-north-1 region
```yaml
version: 1
frontend:
phases:
preBuild:
commands:
- npm i -g corepack@latest
- corepack enable && corepack prepare
- NODE_ENV=ci pnpm i --frozen-lockfile
build:
commands:
- NITRO_PRESET="aws_amplify" pnpm run build
cache:
paths:
- node_modules/**/*
artifacts:
baseDirectory: .amplify-hosting
files:
- '**/*'
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the supplied frontend build configuration, including the pnpm install and node_modules cache path, and compare the cache retrieval and creation timestamps in the logs. Done means identifying and addressing the cause of the slow artifact extraction and creation so the cached build no longer adds over 90 seconds to each step.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt
Domain
build-system, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.