error when I push my project to heroku [remote rejected] [duplicate] - heroku

I tried to deploy my simple django project on heroku, but i couldn't understand how to solve this problem
This is the git push heroku master
remote: Traceback (most recent call last):
remote: File "/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/vendor/runtime-fixer", line 8, in <module>
remote: r = f.read().strip()
remote: File "/usr/lib/python3.8/codecs.py", line 322, in decode
remote: (result, consumed) = self._buffer_decode(data, self.errors, final)
remote: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
remote: /tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/bin/steps/python: line 5: warning: command substitution: ignored null byte in input
remote: ) is not available for this stack (heroku-20).
remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 898dd95ff261fc77ac4dcd00edd162d7b7c054f2
remote: !
remote: ! We have detected that you have triggered a build from source code with version 898dd95ff261fc77ac4dcd00edd162d7b7c054f2
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 portfolio-project10.
remote:
To https://git.heroku.com/portfolio-project10.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/portfolio-project10.git'
C:...\portfolio-project>
It would be very nice if anyone could help me with this, or even recommending an other way to deploy django projects for free

That entire traceback is inside these parentheses: () is not available for this stack. That is the message shown when you request a Python runtime that isn't available. In this case, it looks like your runtime.txt can't even be read due to an unexpected encoding.
Delete it, then create a new file containing something like
python-3.10.2
only. Make sure it is UTF-8 encoded, commit, and redeploy.
At the moment, these are the currently supported Python versions, but the list changes as new versions are released:
python-3.10.2
python-3.9.10
python-3.8.12
python-3.7.12

I had the same issue when i was deploying my django application to Heroku. The issue is because of encoding error. Heroku is expecting the file to be saved with utf-8 but I realised that my file was saved with utf-16 le.
So if you are working in vscode then i would suggest to check the encoding for the runtime file at the bottom of vscode
If you click on utf-8 you will get the option of saving the file with different encoding .
Otherwise you can also save the file in notepad. Default encoding used by notepad is utf-8 only
That will work for sure.
Check for other files encoding also if this doesn't solve the problem

very simple
just delete the runtime.txt and push the code
this worked for me .
thankyou

Related

Heroku: Compiled Slug Size is too large yet my file sizes are small

I am trying to deploy my tweetbot to Heroku but thins have refused to be pushed because of this error below;
Compressing...
remote: ! Compiled slug size: 617.8M is too large (max is 500M).
remote: ! See: http://devcenter.heroku.com/articles/slug-size
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 1a2970cd3545cb60eb76f77769d6cf7c58d3c4ae
remote: !
remote: ! We have detected that you have triggered a build from source code with version 1a2970cd3545cb60eb76f77769d6cf7c58d3c4ae
remote: ! at least twice.
My files are very small so I don't know where the 617M size is coming from
What is the way forward? Thank you.

How to deploy openbazaar-go to heroku

How can I deploy openbazaar-go to heroku?
I got the go project go get github.com/OpenBazaar/openbazaar-go
Created heroku git heroku create
Push git changes git push heroku master
But getting error
remote: -----> Checking Godeps/Godeps.json file.
remote: parse error: Invalid numeric literal at line 2504, column 8
remote: !! Bad Godeps/Godeps.json file
remote: ! Push rejected, failed to compile Go app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to pacific-stream-51465.
Structure go
github.com
└──OpenBazaar
└── openbazaar-go
└──`heroku create` (this I created git project)
This project have any subrepository
What version of Golang are you using? OpenBazaar runs predominantly on 1.11 and isn't currently set up to work well on 1.13 and above.

Difficulties deploying Flask app to Heroku

I am trying to deploy a Flask app to Heroku and I keep getting this error. Anyone who can help me with this?
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (9/9), 3.06 KiB | 184.00 KiB/s, done.
Total 9 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to expensetracker-api-heroku.
remote:
To https://git.heroku.com/expensetracker-api-heroku.git
! [remote rejected] secret-branchh -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/expensetracker-api-heroku.git'
Based on the UPDATED question, the error message is hinting at the problem:
No default language could be detected for this app.
You need to tell Heroku what kind of app you are deploying. For Python apps (i.e. Flask), you need to have one of the following files in your top-level git directory, as described in the Expected files for Python section of Deploying Python and Django Apps on Heroku docs:
Heroku automatically identifies your app as a Python app if any of the
following files are present in its root directory:
requirements.txt
setup.py
Pipfile
If none of these files is present in your app’s root directory, the
Python buildpack will fail to identify your application correctly.
Take note of the the warning at the end that if none of the files are present, the Python buildpack will faill.
The simplest here is to add a requirements.txt file. You can generate this by doing:
pip freeze > requirements.txt
and it looks like this:
Flask==1.0.2
Flask-Scss==0.5
gunicorn==19.7.1
isort==4.3.3
itsdangerous==0.24
Jinja2==2.10.1
...
Add that to the top-level of your git directory.
Then, for Flask, you need to add a couple more files:
runtime.txt
This specifies the Python version of your app, as described in Specifying a Python Runtime
python-3.7.3
Procfile
This is described in this post Heroku Flask Tutorial Procfile Meaning and I suggest you take a look. The contents depends on how you instantiated your Flask app instance, and it looks like this:
web: gunicorn app:app --log-file=-
If you're still having problems, I highly recommend going through the Heroku tutorial docs, especially Getting Started on Heroku with Python.

ROOT_URL is not defined | Pushing is causing a build failure

If I go to the the build log I see the following:
-----> Node.js app detected
FATAL: ROOT_URL is not defined.
! Push rejected, failed to compile Node.js app.
! Push failed
This is what I am getting in my terminal:
remote: Building source:
remote:
remote: -----> Node.js app detected
remote: FATAL: ROOT_URL is not defined.
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to virtually-viral.
remote:
To https://git.heroku.com/virtually-viral.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/virtually-viral.git'
NOTE: I do not know what to do to fix this and get my app working, I have checked multiple discussions on people having a somewhat similar problem but I was not able to fix it with their solutions.
I don't know much about Meteor so I'm not sure why this works in development, nor can I find any canonical list of critical settings that are required for it to work. The closest I can find is the documentation for Meteor.absoluteUrl (bold added):
Generate an absolute URL pointing to the application. The server reads from the ROOT_URL environment variable to determine where it is running. This is taken care of automatically for apps deployed to Galaxy, but must be provided when using meteor build.
You should be able to get past this issue by setting the ROOT_URL variable on Heroku, e.g.
heroku config:set ROOT_URL=https://virtually-viral.herokuapp.com
or through the web interface.

Error on mgo dependency when deploying go app to Heroku

I'm trying to deploy a Go App to Heroku, I'm using godeps for dependency management as their docs suggested.
But when I git push heroku master I get the following error telling that the file sasl.go doesn't exists.
remote: # github.com/grsouza/feeng-api/vendor/gopkg.in/mgo.v2/internal/sasl
remote: vendor/gopkg.in/mgo.v2/internal/sasl/sasl.go:15:24: fatal error: sasl/sasl.h: No such file or directory
remote: // #include <sasl/sasl.h>
remote: ^
remote: compilation terminated.
remote: github.com/grsouza/feeng-api/vendor/github.com/onsi/gomega
remote:
remote: ! Push rejected, failed to compile Go app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to limitless-ridge-36512.
remote:
To https://git.heroku.com/limitless-ridge-36512.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/limitless-ridge-36512.git'
Can anyone help me with this issue?
Thanks.
Do you use godep save ./... in your project?
If yes, delete the Godep and vendor directories and try to use godep save, without ./....
I do this and work for me.
Error tells sasl/sasl.h missing but not sasl.go. sasl.h header file is part of libsasl2-dev package which not installed on heroku and I don't know simple way to install it. To my mind you can try to find sasl headers on your local machine(most likely /usr/include/sasl)and copy to vendor/include/sasl in your local go app source. Then make them visible for CGO using heroku config vars doing
heroku config:set CGO_CFLAGS= -I/app/code/vendor/include/sasl
in heroku console, and than git push.
Also you can look for libsasl2-dev buildpack for heroku and try to use two buildpacks for your app with something like
heroku buildpacks:add heroku/some_libsasl2-dev
I finally found a solution (from https://github.com/go-mgo/mgo/issues/220#issuecomment-212658192):
run godep save ./... (to create the vendor directory with all the dependencies)
then re-run godep save without ./... (this will remove unused files)

Resources