Skip to content

Build fails when cache is restored: unzip prompts to overwrite existing files, gets EOF, exits non-zero #5

@vishal24367

Description

@vishal24367

Symptoms

Every build after the first (i.e., when the awscli cache layer is restored) fails with:

replace aws/install? [y]es, [n]o, [A]ll, [N]one, [r]ename:  NULL
(EOF or read error, treating as "[N]one" ...)
 !     awscli: Failed to extract AWS CLI
ERROR: failed to build: exit status 1

Root cause

In bin/build, the buildpack always downloads a fresh awscli.zip and extracts it into $AWS_CLI_LAYER_DIR regardless of whether the cache was restored. When the cache IS restored, $AWS_CLI_LAYER_DIR already contains the aws/ directory from the previous install. Running unzip -q awscli.zip (no -o flag) causes unzip to prompt about replacing existing files. In a non-interactive build environment, unzip reads EOF and treats it as "None" (skip all), then exits with a non-zero code. The || { exit 1 } error handler catches this and prints "Failed to extract AWS CLI".

Fix

Two changes in bin/build:

  1. Immediate: Change unzip -q awscli.zipunzip -qo awscli.zip (-o = overwrite without prompting). This prevents the EOF prompt failure.

  2. Correct: Add proper cache reuse logic — if the cached binary exists and is for the same architecture, skip the download+install entirely. This avoids the 64MB download on every build.

Impact

Observed on neeto-deploy-slug-compiler-web production builds — all builds since the cache was first written are failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PRThe issue has a PR associated with it.workingA branch associated with this issue is created.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions