2

Hello i am trying to deploy my flask app via heroku. I have been following this site: https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app

Everything worked until this command:

git push heroku main:main

I receive this error

(base) name@mac cwesterink.github.io % git push heroku main     
Enumerating objects: 178, done.
Counting objects: 100% (178/178), done.
Delta compression using up to 4 threads
Compressing objects: 100% (97/97), done.
Writing objects: 100% (178/178), 44.11 KiB | 44.11 MiB/s, done.
Total 178 (delta 64), reused 178 (delta 64), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 479f8868ba69f9c7ad9caa5dab5b7bf0b5347d3c
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 479f8868ba69f9c7ad9caa5dab5b7bf0b5347d3c
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to aqueous-caverns-46845.
remote: 
2020-12-08T04:23:19.788222+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=floating-sierra-24488.herokuapp.com request_id=dd03fcc6-1283-4bc5-8245-af22b4101145 fwd="98.210.226.124" dyno= connect= service= status=503 bytes= protocol=https
2020-12-08T04:23:21.171843+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=floating-sierra-24488.herokuapp.com request_id=02ba31f9-e946-486f-b73e-af635c7ec14d fwd="98.210.226.124" dyno= connect= service= status=503 bytes= protocol=https
2020-12-08T04:27:40.157382+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=floating-sierra-24488.herokuapp.com request_id=a6b20915-6ff6-41ba-9aba-cd421d6f0045 fwd="98.210.226.124" dyno= connect= service= status=503 bytes= protocol=https
2020-12-08T04:27:41.015113+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=floating-sierra-24488.herokuapp.com request_id=9c2b7fb3-49c3-4745-8816-c24363448f49 fwd="98.210.226.124" dyno= connect= service= status=503 bytes= protocol=https```

Any help to solve this problem would be greatly appreciated.
  • "One common cause" of this is pushing to a non-`main`-or-`master` branch. But that's not the _only_ cause. Are you just pushing the same thing over and over? What is in the build output _before_ this? That's where the useful stuff is. – ChrisGPT was on strike Dec 08 '20 at 02:25
  • I had another error at this step before so i reinstalled the brew heroku. Could that be the problem? Is there a way i can start on clean slate? – Constantine Westerink Dec 08 '20 at 02:50
  • That is almost certainly irrelevant. _Again_, there is probably helpful information _above_ what you have shown us. Please [edit] your question and add whatever comes before this in your build log. – ChrisGPT was on strike Dec 08 '20 at 02:51
  • Sorry i'm very new to web apps. I have updated the post and added the previous results. – Constantine Westerink Dec 08 '20 at 03:03
  • There it is: "No default language could be detected for this app". What language (and framework, if appropriate) are you trying to use? – ChrisGPT was on strike Dec 08 '20 at 03:36
  • Oh i thought the default language was the same as the buildpack. Where can i set the default language? – Constantine Westerink Dec 08 '20 at 03:41
  • You generally don't need to specify the default language _or_ the buildpack. You _can_ specify the buildpack, but I don't recommend it in most cases. You just need to include the right files (this is true even if you specify a buildpack explicitly). _Again_, what language are you trying to use? – ChrisGPT was on strike Dec 08 '20 at 03:44
  • I am using python with the flask web framework. In my repo I have : a CNAME(for custom domain), Readme.md ,main python script, templates folder with html files, and requirements.txt. – Constantine Westerink Dec 08 '20 at 03:50
  • Okay, so you need either a `requirements.txt` (for `pip`) file or a `Pipfile` and `Pipfile.lock` (for Pipenv). In both cases the files must be in the root of your repository. – ChrisGPT was on strike Dec 08 '20 at 03:52
  • I have a requirements.txt in my repo. I took it from the internet. Do you mind checking my repo @: https://github.com/cwesterink/cwesterink.github.io.git – Constantine Westerink Dec 08 '20 at 04:07
  • Your "we have detected that you have triggered..." message references [commit `479f8868`](https://github.com/cwesterink/cwesterink.github.io/tree/479f8868ba69f9c7ad9caa5dab5b7bf0b5347d3c), which does _not_ contain a `requirements.txt` file. Please make sure you are pushing the updated `main` branch _with_ that file. At the moment its hash is `ed13e291`. – ChrisGPT was on strike Dec 08 '20 at 04:12
  • I updated it and i was able to push it. Although the website https://floating-sierra-24488.herokuapp.com/ does not work. I added the logs on the post – Constantine Westerink Dec 08 '20 at 04:32
  • That's a different problem and should be asked in a different question. Better yet, start by [searching for existing questions and answers](https://stackoverflow.com/search?q=No+web+processes+running) as described in [ask]. Many people have asked about this already. – ChrisGPT was on strike Dec 08 '20 at 13:28

1 Answers1

0

If you know you have been using 'main' and not 'master' in heroku, you can trigger rebuild by force pushing:

git push heroku main --force

Jkarttunen
  • 6,764
  • 4
  • 27
  • 29
  • Are you sure about this? `git push --force` is a _Git_ thing, not a Heroku thing. Pushing whatever commit is already at the tip of the `main` branch to the `main` branch (a) shouldn't require `--force` and (b) shouldn't do anything, with or without `--force`. Also, [Heroku builds from `main` or `master` as of this past July](https://devcenter.heroku.com/changelog-items/1829). – ChrisGPT was on strike Dec 08 '20 at 13:26
  • (Also, any time you recommend `git push --force`, please include a warning. This is a destructive operation. `--force-with-lease` is still destructive, but it's a safer option.) – ChrisGPT was on strike Dec 08 '20 at 13:27
  • Heroku documentation recommends force pushing. See https://devcenter.heroku.com/articles/git#:~:text=To%20deploy%20your%20app%20to,heads%2Fmaster'%20... "The -f (force flag) is recommended in order to avoid conflicts with other developers’ pushes. Since you are not using Git for your revision control, but as a transport only, using the force flag is a reasonable practice." – Jkarttunen Dec 08 '20 at 13:30
  • 1
    Also force pushing is the only way, if you want to push from feature branch, e.g. git push heroku myfeature:master --force – Jkarttunen Dec 08 '20 at 13:31
  • It is heroku thing, because heroku only tracks and triggers builds on latest commit on master or main branch – Jkarttunen Dec 08 '20 at 13:32
  • Don't quote out of context. From the documentation you quoted, bold added: "**Since you are not using Git for your revision control, but as a transport only**, using the force flag is a reasonable practice". That part is _critical_. That's in [the section for users of non-Git version control systems like Subversion](https://devcenter.heroku.com/articles/git#using-subversion-or-other-revision-control-systems). Heroku does _not_ recommend using `--force` by default. – ChrisGPT was on strike Dec 08 '20 at 13:40
  • "force pushing is the only way, if you want to push from feature branch"—nonsense. It depends on the specific branches involved. _Sometimes_ it makes sense to force push, but not _always_. And in those cases, as I noted earlier, `--force-with-lease` is a safer alternative. – ChrisGPT was on strike Dec 08 '20 at 13:41
  • "heroku only tracks and triggers builds on latest commit on master or main branch"—true, but if that commit _doesn't change_ with a push, `--force` or not, does Heroku rebuild? The last time I used it it did not, hence the need to do awkward things like [adding empty commits to trigger a rebuild](https://stackoverflow.com/a/41347235/354577) in corner cases. – ChrisGPT was on strike Dec 08 '20 at 13:42
  • Not sure if it has changed recently, i've used --force to manually trigger rebuilds without adding empty commits. – Jkarttunen Mar 11 '21 at 18:44