aws-amplify / aws-amplify/amplify-cli

Option to "do you want to edit this now" blocks Post-add-function hook from running

Open
#11,895 1 comment 0 reactions 0 assignees View on GitHub
feature-request p3 platform platform-hooks
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Is this feature request related to a new or existing Amplify category?

function

### Is this related to another service?

_No response_

### Describe the feature you'd like to request

Noticed today that my post add function hook is blocked from running due to a nice to have in the CLI.

When you create a function the last question it asks you is "Do you want to edit the local lambda function now?", if you answer yes to this then it opens the index.js file in your editor and asks you to "Press enter to continue".

That then blocks the function creation from completing until you indeed press enter. Only then does the post-add hook fire.

To me there is no reason why my hook shouldn't fire before the "would you like to edit this now", the function at that point has been created so run my hook and don't block me from having to press enter.

Additionally my hook actually changes the extension of the index file to index.ts so the open in editor would fail unless you sniffed out an index.* file on your end?

Hook I'm running adds TypeScript to my functions automatically:

https://github.com/PeteDuncanson/aws-amplify-hooks

### Describe the solution you'd like

See above. Let me hook run before you start asking nice to have DX questions :)

### Describe alternatives you've considered

Well I can't do anything, pondered adding a "pre-add-function" hook but I'm not sure when that would actually run and the docs make no mention of when a pre hook would run either. I'm assuming that runs before the user enters anything via the CLI so not of use to me I think?

Alternative at the minute is either answering "no" to editing no, then hitting enter then the hook runs. Or if I answer "Yes" to editing I have to switch focus back to my CLI to his enter, then the hook runs, then back to the editor to close the index.js file as it doesn't exist!

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is named. Trace the function-creation flow and compare when the post-add hook runs with the edit prompt and its “Press enter to continue” wait. Done means the hook runs before that prompt blocks, while the editor behavior remains compatible with the generated function file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.