'Heroku deployment with Git fails with 504 Gateway TImeout

Due to the recent problems on Heroku´s Dashboard, I am trying to deploy directly my app through Git as stated here: https://devcenter.heroku.com/articles/git#deploy-your-code

Running the following command: git push heroku main

produces the following output:

Enumerating objects: 11344, done.
Counting objects: 100% (11344/11344), done.
Delta compression using up to 8 threads
Compressing objects: 100% (9862/9862), done.
Writing objects: 100% (11344/11344), 1.44 GiB | 210.18 MiB/s, done.
Total 11344 (delta 1833), reused 9874 (delta 1353), pack-reused 0

After a long time the deployment fails due to the following error:

error: RPC failed; result=22, HTTP code = 504
fatal: The remote end hung up unexpectedly

I have already tried to increase the postBuffer in case it helped but to no avail:

git config http.postBuffer 2147483648

The slug size of my previous deployment after compression is 121M, which should not be either a problem, since the changes I have made are minimal.

I dont know, I have always deployed manually through Heroku´s Dashboard, but now I ve been a week without being able to do itand I am running out of ideas other than waiting for the features to be restored, which seems to take long. Any ideas would be really appreciated



Solution 1:[1]

I had the exact same problem deploying after the Heroku/Github dashboard was disabled and swapped to the Heroku-CLI.

You apparently need to specify which branch you are pushing from even when pushing from "main" and which remote heroku branch to push too (also main)

For example, to deploy code to Heroku from a non-main branch of your local repository (for example, testbranch), you'd use the following syntax push it to the remote’s main branch:

git push heroku testbranch:main

It usually defaults but now we have to specify main/master

TL;DR You can fix it with:

git push heroku main:main

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1