-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hooks in Amplify v.10.0.0 runs only once(first time when branch is connected) in CI/CD Pipeline. Locally - as expected. #11021
Comments
I'm facing this problem also |
hey @hackmajoris, thank you for reaching out. I was able to replicate the behaviour in my Amplify application. observed the amplify push does not get invoked when a resource has been updated. observed the following output at the end of the build. marking this as a bug for further investigation. removing |
@ykethan any updates on this issue? Don't know how you prioritised it, but it's kind of a blocker, since if updating to version >=10.0.0 there is no any workaround to get the hooks working. If there is no any prioritisation then perhaps it's better to rollback the hooks refactorization done in v.10. |
hey @hackmajoris, thank you for checking in. Currently, the Amplify team is investigating into this behavior and will provide any updates on this issue here. |
@ykethan thank you for your fast response. Just removing the If re-using the same name for the stack, as for the original issue description: "Dropping the |
Hey @hackmajoris, thank you for providing us the information, and great callout regarding the |
Closing this issue, as the fix was done in #11179 and released with Amplify v10.3.2. |
What version of Amplify are you running? @hackmajoris |
@evcodes this is a good news. I run on 9.2.1 |
Can you please try this out with latest? 10.4.1 |
@evcodes @ykethan Still no hooks run after first build on 10.4.1. Info: amplifyPush --simple is used for CI Using the command Proof: List hooks dir before running List hooks dir after running Again, the changes which were done here: https://github.com/aws-amplify/amplify-cli/pull/11179/files#diff-e4044365569b0d6894bc87f33a263088f2ff5145bb90c64b8744595bdc129212 (PR closed in respect for hooks fix) are not in the 10.4.1 release: But they are on the dev branch: https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-cli/src/attach-backend.ts Realease a new release with the changes made in the #11179 and let's test that one. |
Hey @hackmajoris, sorry for the delay. You are right. Here is the dif between 10.4.1 and 10.5 v10.4.1...v10.5.0#diff-e4044365569b0d6894bc87f33a263088f2ff5145bb90c64b8744595bdc129212L100-L123 Please try with 10.5.0 and this should solve the hooks issue. |
@evcodes Thanks for the updates. I did test. It works with the 10.5.0! One more thing: I'm asking because, locally, when running |
I believe that this is something for Hosting team to answer. I am going to close this issue as the original issue is resolved |
Just followed up with Hosting. This is in fact the expected behavior. AMPLIFY_DIFF_BACKEND checks to see if there are any code changes - If there's no change since the previous commit, the build is skipped |
Before opening, please confirm:
How did you install the Amplify CLI?
remote config
If applicable, what version of Node.js are you using?
16.15.9
Amplify CLI Version
10.0.0
What operating system are you using?
Linux
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
Depends
Amplify Categories
hosting
Amplify Commands
push
Describe the bug
Starting with Amplify v.10.0.0, the hooks should be checked in to the source control.
I have a post-push.js hook which is needed to be triggered.
After connecting the branch in the CI/CD Pipeline in the Amplify Console for the first time, the hook is executed with success.
If another commit/build is triggered, the build runs without executing the hook.
Locally, every time the
amplify push
is executed, the hook is also triggered.Expected behavior
The hook is triggered at every CI/CD build trigger.
Reproduction steps
GraphQL schema(s)
Project Identifier
a88954c5b3c47e78dce85b3e0fd819c8
Log output
First build
Second Build
Additional information
No workaround yet.
But, if you check the second build logs, there is that error:
"The maximum number of apps that you can create with Amplify in this region has likely been reached" related to aws-amplify/amplify-hosting#2797
Could be that it breaks the execution of the hooks.
Worth to mention that the script: https://github.com/aws-amplify/amplify-hosting/blob/main/scripts/amplifyPush.sh
is used for remote deployment. Maybe it should be updated also.
Update:
The issue is definitely in the https://github.com/aws-amplify/amplify-hosting/blob/main/scripts/amplifyPush.sh.
I did run the deployment without --simple flag, and at least it executes the hooks:
Update:
Dropping the
--simple
flag and have a branch name without special characters (see: #979), then the hooks are executed as expected, at each build, but it fails because it tries to re-create the stack.Conclusion:
After the first build, the stack is pulled from the cache, and it doesn't have the hooks because they are not stack related.
The text was updated successfully, but these errors were encountered: