amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

post-push.js is not executing anymore

Open danielhstahl opened this issue 3 years ago • 1 comments

Before opening, please confirm:

App Id

dkn95cusc5c8

Region

us-west-2

Amplify Hosting feature

Backend builds

Describe the bug

We have a post-push.js script which runs on after every build. This has been working without fail for months. On Tuesday it stopped working for us on some of our existing branches. Today I created a new branch and post-push.js ran on it, but when redeploying post-push.js no longer runs. The post-push.js file exists in the app S3 bucket. When I pull the environment locally the post-push.js file exists. When I attempt to deploy locally it runs post-push.js locally.

Expected behavior

post-push.js should continue running after a build.

Reproduction steps

  1. Add post-push.js to your hooks folder
  2. Push to your github branch that is connected to amplify
  3. Amplify builds and post-push.js runs
  4. Push another change to the same branch
  5. Amplify builds but post-push.js does not run

Build Settings

version: 1
env:
  variables:
    NODE_OPTIONS: --max-old-space-size=6500
backend:
  phases:
    preBuild:
      commands:
        - yum install -y yum-utils
        - yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
        - yum install -y terraform
        - yum install -y python3

    build:
      commands:
        - update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 11
        - /usr/local/bin/pip3.8 install --user pipenv
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple

Additional information

No response

danielhstahl avatar Sep 09 '22 00:09 danielhstahl

It's due to the fact that the Amplify v10.0.0 changes how the Hooks are handled. Now you have to check-in them in the version control. The hooks folder isn't uploaded to S3 anymore.

I think, setting the version in the Amplify Console/You App/Build Settings/ to the previous version of Amplify: 9.2.1, will work for you.

Screenshot 2022-09-17 at 19 41 58

However, with the v10.0.0 of Amplify, there is another issue: https://github.com/aws-amplify/amplify-cli/issues/11021

hackmajoris avatar Sep 17 '22 16:09 hackmajoris

Hi everyone 👋 , thanks for reaching out to us and we apologize for the delayed response on this thread.

It seems that this issue was fixed with the release of Amplify CLI version 10.5.0 as confirmed here: https://github.com/aws-amplify/amplify-cli/issues/11021#issuecomment-1319321271.

I am going to close this thread but please feel free to open a new GitHub issue if you are experiencing issues with Amplify Hosting.

Jay2113 avatar Jun 30 '23 21:06 Jay2113

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar Jun 30 '23 21:06 github-actions[bot]

This issue has been automatically locked.

github-actions[bot] avatar Jun 30 '23 22:06 github-actions[bot]