When trying to deploy a branch on a Heroku app, I'm getting the following error:
Host key verification failed.
fatal: Could not read from remote repository.
There is one exception to this verification failed: I can deploy my branch on one specific pre-existing app with no issue. However, other than that specific app, I can't seem to deploy the branch - even when I create entirely new apps.
Heroku has a support page for this particular issue here: https://help.heroku.com/SP5I8HXO/host-key-verification-error-when-accessing-private-github-repository
However, it's not clear to me what I should do once I generate the PAT. Also, it's not clear to me why this issue would show up on review apps (part of the same pipeline as the one app that's working) and on entirely new apps.
How do I resolve this issue?
Edit:
Here's the complete deployment log.
Building on the Heroku-18 stack
Determining which buildpack to use for this app
Node.js app detected
Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
USE_YARN_CACHE=true
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
Installing binaries
engines.node (package.json): 16.x
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): 1.22.x
Resolving node version 16.x...
Downloading and installing node 16.13.1...
Using default npm version: 8.1.2
Resolving yarn version 1.22.x...
Downloading and installing yarn (1.22.17)
Installed yarn 1.22.17
Installing dependencies
Installing node modules (yarn.lock)
yarn install v1.22.17
[1/4] Resolving packages...
warning react-scripts > webpack-dev-server > chokidar > fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://git#github.com/ljharb/qs.git
Directory: /tmp/build_5650c4ab
Output:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
I recently solved this issue which occurred when switching over to yarn from npm.
The solution was to clear the buildpack cache.
I was deploying using a github actions script, here is what I did.
In the file .github/workflows/deploy.yml which configured the deployment to heroku through github actions I added buildpack: false.
This cleared the buildpack cache in heroku and then the deployment completed successfully.
Afterwards I enabled buildpack caching again and all was well.
Heroku's documentation isn't entirely clear:
Heroku does not have the private keys necessary to access your private Github repositories, and as such, attempts to access those private repos will fail.
This affects access via SSH, i.e. URLs named like git#github.com:username/repo.git.
The suggestion to use a token instead also requires that you change to an HTTPS URL. You can copy your HTTPS URL from your repository, via the "Code" dropdown:
Click on "HTTPS", then copy the URL. Or, you can just reformat your existing URL so that it matches https://github.com/username/repo.git.
The token you generated can be used in place of a password when cloning via HTTPS, but you need to provide it to Heroku somehow. URLs have a built-in mechanism for this, called the "authority".
To add the username username and personal access token token to the URL, add username:token# between https:// and github.com:
https://username:token#github.com/username/repo.git
Give that URL to Heroku and try again.
Related
Problem
I was facing difficulty in importing one of the packages properly and using it in my MERN application in the backend. After researching and looking at the deployed code I got to know that my application is using the unwanted version of that package and thus it is causing the issue but I already changed the version in package.json before pushing. I have written unwanted here because in my case the new version of the package has bugs and that's why I want the old/previous version back but I am unable to know the exact reason or thing which is causing heroku to use the unwanted version again and again.
For Clarity:
initial version: 1.6.6 (was working fine)
then I installed version: 1.7.0 (found bugs) unwanted version
tried to go back to version: 1.6.6 but couldn't
What I have tried
The first thing I tried was setting NODE_MODULES_CACHE to false to avoid heroku from picking up old code as it has worked for me in the past. Apart from that I have I can't find any other thing.
There is nothing suspicious in the heroku logs and it builds the application without any error.
I found the solution to it if someone's looking for it. It is not much of a solution instead it's more about how heroku works.
Heroku uses npm ci instead of npm install.
npm ci installs all dependencies in respect to package-lock.json similar to npm install. The key difference here is that ci doesn't alter package-lock.json under any circumstances.
So basically, the package-lock.json was still the unwanted one in my case and heroku was installing that rather than what I pushed into package.json as it didn't matter.
So, in order to solve this issue you have two options:
You can push your updated package-lock.json. In my case I had intentionally not added package-lock.json to versioning as I thought heroku would update it so I had put it in .gitignore
You can set the USE_NPM_INSTALL environment variable to true to let Heroku know that you want to use npm install instead of npm ci to create the build environment. (NOTE: If you want to use npm install Heroku advises to use NODE_MODULES_CACHE=false as it speeds up the build time)
I went with option 1.
Link to Heroku docs: https://devcenter.heroku.com/articles/nodejs-support
I have added this pdftk buildpack to my free app on Heroku: https://github.com/fxtentacle/heroku-pdftk-buildpack.git.
I am unable to deploy my application to Heroku:
Preparing runtime environment...
-----> Checking for additional extensions to install...
-----> heroku-pdftk-buildpack app detected
cp: cannot stat 'binaries-heroku-18/*': No such file or directory
! Push rejected, failed to compile heroku-pdftk-buildpack app.
! Push failed
Also, I have added heroku/php and set the index of this buildpack to 1. When I go to my app's temporary URL, Laravel runs, but for some reasons, pdftk doesn't seem to run. Has anybody faced the same issue?
That buildpack hasn't been updated for the heroku-18 stack. Its compile script tries to copy precompiled binaries from binaries-$STACK/ into /app/bin/, but only contains binary directories for cedar-14 and heroku-16.
You could roll your app back to heroku-16, which will be supported until April, 2021, but of course this will also change other package versions:
heroku apps:stacks:set heroku-16 --app myapp
This would be very similar to going from Ubuntu 18.04 to Ubuntu 16.04, but it's likely to be your simplest solution.
Alternatively, you could fork the pdftk buildpack you found and update it for Ubuntu 18.04, but that isn't likely to be straightforward.
pdftk was removed from Ubuntu's official repositories because it depends on a deprecated library called gcj. The buildpack you're trying to use includes libgcj for cedar-14 and heroku-16 in their respective binary directories. You'll have to include that as well if you want to update the buildpack.
Also, I have added heroku/php and set the index of this buildpack to 1. When I go to my app's temporary URL, Laravel runs, but for some reasons, pdftk doesn't seem to run. Has anybody faced the same issue?
The error you're seeing is preventing your application from being deployed. You're not seeing a new version of the application with pdftk, but whatever was last deployed successfully. You'll have to resolve the build issue before you can use pdftk.
I followed this article (http://derekbarber.ca/blog/2014/11/20/using-pdftk-with-rails-on-heroku/) and got PDFTK working on Heroku-18, though on a Rails app.
Code excerpted below, HT #derek-barber.
mkdir -p [my_project]/vendor/pdftk/lib [my_project]vendor/pdftk/bin
cd /tmp
git clone https://github.com/millie/pdftk-source.git
cd pdftk-source
tar xzvf pdftk.tar.gz
mv bin/pdftk [my_project]/vendor/pdftk/bin/
mv lib/libgcj.so.12 [my_project]/vendor/pdftk/lib/
cd [my_project]
git add -f vendor/pdftk/
git commit -m "Add pdftk dependencies"
git push heroku master
heroku config:set LD_LIBRARY_PATH=/app/.heroku/vendor/lib:/app/vendor/pdftk/lib
heroku config:set PATH=/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin:/app/vendor/p
Once this PR is merged: https://github.com/fxtentacle/heroku-pdftk-buildpack/pull/9 then the buildpack should work with heroku-18 stack.
Maybe leave a comment to the repo owner asking them to merge?
For now, you could use the forked & updated version: https://github.com/Aesthetikx/heroku-pdftk-buildpack which works with heroku-18 stack.
If you are using an app.json file, then point the pdftk buildpack to the forked version:
"buildpacks": [
...,
{
"url": "https://github.com/fxtentacle/heroku-pdftk-buildpack.git"
}
]
The project is attached through my github and it builds successfully, when I click "Open App" I get this an "Application Error"...
My "log" on Heroku looks like:
Node.js app detected
Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 6.x...
Downloading and installing node 6.11.2...
Using default npm version: 3.10.10
Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
Building dependencies
Installing node modules (package.json)
Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
Build succeeded!
Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
Compressing...
Done: 42.5M
Launching...
Released v10
https://ken-neiheisel-studio.herokuapp.com/ deployed to Heroku
And my package.json
Not sure exactly what the problem is?
Recently had same problem using Heroku for the 1st time, where everything looked right, the Build completed fine, yet I couldn't seem to not get the "Procfile declares types -> (none)" error in the log. I tried everything then realized I must have previously bad version of Procfile in that project that was invisible to me. I was looking at my visible Folders in Windows, where the Procfile was perfect.
To fix I deleted my Procfile from the projecct folder. Did a fresh git add . and a fresh git commit -m "xxx" to load all the files to git/heroku...leaving Procfile out intentionally. That served to clear out the bad version of Procfile that was stored or cached in git or heroku. Then I added a new Procfile to the folder. Another git add . and commit -m, and finally all the weird errors surrounding the Procfile cleared and the App loaded to heroku/web.
I get the following error after deploying my Yeoman app to Heroku
GET http://myapp.herokuapp.com/favicon.ico 503 (Service Unavailable)
I have a favicon image, and everything runs fine locally with the favicon image appearing. I'm not sure how to fix this error or why it is being caused in the first place.
Here is all my code: https://github.com/dkretsch12/MyHerokuApp
And I push it to Heroku with the following commands:
git add .
git commit -am "still stuck"
git push heroku master
I also ran into this, and for me it turned out the '503 (Service Unavailable)' error was not the real error.
Try:
heroku logs --app [your-app-name]
and see if it gives you more info.
In my case it was that Heroku was looking for npm start script, which I had not specified, but is required by Heroku.
Looking at your package.json I see you don't have it either, so that might be the place to start.
edit
I think the underlying reason for this error is that by default Heroku expects a webserver or some kind executable to be running in the background. It's needed because otherwise incoming requests would not be handled. So it has to be provided by the programmer, and after installation Heroku will run it, either by npm start or by what is specified in the Procfile.
I my case I needed a webserver anyway, so I just created a server.js module where I implemented a small express app. Then in package.json I specified:
"scripts": {
"start": "node server.js",
...
},
But this may not be the right solution for you, it depends on what you want with your app. I don't know anything about Grunt or Angular, so I can't help you there. I did find this question which may be of value to you. I also recommend reading the docs on Heroku Dev Center
I had the same 503 service unavailable error favicon.ico, when attempting to open a Heroku deployed Rails/React app. I was stuck on this bug for at least an hour, and thought this post may provide insight on how I solved the 503 favicon issue.
Step 1: I tried to locate a favicon.ico file in my rails app, tried creating my own favicon.ico file, and placing said file in the root and other directories. I got the same error...
Step 2. I ran the following in terminal: heroku logs -t, scrolled up and found the actual error to be Heroku failing to support gem sqlite3.
An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.
remote:
remote: In Gemfile:
remote: sqlite3
remote: !
remote: ! Failed to install gems via Bundler.
remote: ! Detected sqlite3 gem which is not supported on Heroku:
remote: ! https://devcenter.heroku.com/articles/sqlite3
More info as to why is here.
Step 3: After learning more, I discovered I can either follow the heroku documentation to figure out how to use sqlite3 with heroku, or change DB. I chose to change DB to postgres, and I found two amazing resources to help with that:
how to change your rails app database from sqlite to postgresql before deploying to heroku.
Change from SQLite to PostgreSQL in a fresh Rails project
Step 4: After doing so, I got a 500 internal server error, went to heroku logs -t again, and found out that my tables did not exist on heroku. From there, I knew I had to migrate rails DB to heroku using the following command: heroku run bundle exec rails:db migrate. Pushed to heroku and that did the trick.
TLDR: A status 503 unable to find path="/favicon.ico" doesn't necessarily mean the issue stems from a missing favicon.ico in a heroku deployed app. A more insightful method for determining root cause is to use heroku logs -t.
I am trying to install FFMPEG to work with my NodeJs server.
I am using heroku-buildpack-multi plugin:
heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
I have created a .buildpacks (without extesion) file at my github repository. This is what it includes:
https://github.com/jayzes/heroku-buildpack-ffmpeg
https://github.com/heroku/heroku-buildpack-nodej
Each time i am trying to push my changes to heroku, this is what i get:
-----> Fetching custom git buildpack... failed
! Push rejected, error fetching custom buildpack
Unforlunatly, there is not much information regarding ffmpeg installtion
on heroku. What am i missing here?
I just tried this with a demo app I cloned from Heroku:
https://github.com/heroku/node-js-getting-started.git
I was able to deploy successfully following the same steps you listed above, except I added an 's' to the end of your second buildpack (you have a typo - could this be the issue?): https://github.com/heroku/heroku-buildpack-nodejs
I would recommend following the same process with a fresh codebase to help troubleshoot your environment. But note two things: 1) The heroku-buildpack-multi plugin you're using is deprecated, and 2) Heroku officially supports multiple buildpacks:
https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app
and has an officially supported ffmpeg buidback you can use:
https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest