aws-amplify / aws-amplify/amplify-hosting

Wrong AWS_COMMIT_ID for webhook-triggered builds

Open
#3,447 6 comments 2 reactions 0 assignees View on GitHub
feature-request webhooks
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

NA

### AWS Region

us-east-1

### Amplify Hosting feature

Webhooks

### Describe the bug

- When we deploy Amplify application by triggering build through web hook its displays "HEAD" as "Commit ID".
- AWS_COMMIT_ID = Commit ID = HEAD
- You may refer the attached screen-shot files.
amplify-app-webhook-test-1
amplify-app-webhook-test-2
amplify-app-webhook-test-3

### Expected behavior

AWS_COMMIT_ID = Commit ID = GitHub Commit Hash

### Reproduction steps

1. create sample React App
2. create private repository in GitHub and host all files, directories of React application.
3. deploy Amplify app using GitHub CI/CD and by triggering build through web hook.
4. check and verify "AWS_COMMIT_ID" for GitHub CI/CD and web hook triggered builds.

### Build Settings

```yaml
version: 1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- echo $AWS_COMMIT_ID
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- echo $AWS_COMMIT_ID
- npm ci
build:
commands:
- echo $AWS_COMMIT_ID
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
```

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the webhook-triggered and GitHub CI/CD builds using the provided Build Settings, then compare the logged AWS_COMMIT_ID values. The issue is resolved when webhook builds expose the GitHub commit hash rather than HEAD. No source file or test location is identified in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, react
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.