aws-amplify / aws-amplify/amplify-cli

pre-build-function hook does not invoke on push

Open
#12,746 3 comments 0 reactions 0 assignees View on GitHub
bug functions p2 platform-hooks
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

_No response_

### If applicable, what version of Node.js are you using?

_No response_

### Amplify CLI Version

12.0.3

### What operating system are you using?

Mac

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

no

### Describe the bug

According to https://docs.amplify.aws/cli/project/command-hooks/#how-to-name-command-hook-scripts, amplify CLI supports hook for pre build function hooks.
When running `amplify build function` this works as expected
but when running push which does also run function build does not invoke the hook

### Expected behavior

run function hooks

### Reproduction steps

1. create sample function
2. create a sample hook with a simple console log
3. run `amplify function build` to verify the hook runs
4. then run `amplify push`

observe the hook does not invoke

### Project Identifier

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

### Before submitting, please confirm:

- [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.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with `amplify function build` and `amplify push`, using the command-hook naming documentation as the reference. Trace the CLI's push flow and function build path to determine why the pre-build-function hook is skipped during push; done means the hook runs in both commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.