Bitbucket pipeline giving ! [remote rejected] HEAD -> master (pre-receive hook declined) on pushing to heroku

When using bitbucket pipeline: After pushing to the server, I am getting this error after the server is in process:

! [remote rejected] HEAD -> master (pre-receive hook declined)

I think that it wont be an issue on heroku pre-receive config as when I try to push directly from my PC, it works fine. It does takes 25-30 mins and I am assuming that this timeout bit could be the reason?

What I have tried :

I have added size: 2x to increase build time but this doesnt seems to have any improvement so far.

Heroku logs say: Build failed, check your build logs.

Build logs on heroku: All it displays is the webpack build process logs, I dont see any error on that part