AWS Amplify hosting for NextJS SSG with command hooks for security check before deployment

18 views Asked by At

I am having a use-case of developing several NextJS applications (SSG) and deploying them to AWS Amplify. I am using AWS amplify hosting, where directly linking each GitHub repository to amplify apps. And configuring YAML file for frontend deployment. All applications are deployed and working fine.

Problem statement: Now I need to setup a quality gate in the deployment process, Where I have to check certain parameters (Package version of few NPM modules) before deployment.

I am trying to implement this with command hooks. Officially its mentioned pre and post push hooks will get triggered by default in amplify hosting.

  • I have added amplify/hooks folder.
  • Have placed two files pre-push.js and post-push.js with some console statements. (refer attached image)

Build setting YAML:

enter image description here

When I tried to trigger a build, these scripts are not getting executed. Am I missing anything OR will be applicable only for backend execution?

Is there any other better way to handle this use-case with AWS amplify for SSG deployments?

Thanks in advance.

enter image description here

0

There are 0 answers