deploying node application on existing heroku app - node.js

I'm trying to deploy me node application which is running sucessfully running on localhost. For this, I have installed heroku cli on my machine, and I'm opening GIT cli to do the following:
Heroku Login -- successful
git push heroku master -- trying to push to an existing heroku app.
I've already deleted the heroku app it is refering to. Still it is pointing to the same app.
Even after reopening the git cli, it is pointing me to that and push is failing (git push heroku master)
Here the question is,
How to point my git to a newly created heroku app (everytime I'm creating a new app not knowing the command to point to the existing app)
Thanks in advance.

The easier way to add your heroku app remote reference is running the command below from your git folder:
heroku git:remote -a name-of-your-heroku-app
to verify if the remote heroku ref was correctly added you can run:
git remote -v

When running the application using the heroku open command, facing the following issue. Any clue where i went wrong..?
2018-11-12T18:59:19.888307+00:00 app[api]: Scaled to web#1:Free by user *********#email.com
2018-11-12T18:59:19.867050+00:00 app[api]: Deploy 77ec2d50 by user *************#email.com
2018-11-12T18:59:25.456322+00:00 heroku[web.1]: Starting process with command node mp3.js
2018-11-12T18:59:29.846039+00:00 heroku[web.1]: State changed from starting to crashed
2018-11-12T18:59:29.848349+00:00 heroku[web.1]: State changed from crashed to starting
2018-11-12T18:59:29.804086+00:00 heroku[web.1]: Process exited with status 127
2018-11-12T18:59:29.620089+00:00 app[web.1]: bash: node: command not found

Related

No such app found after I change my heroku app name

When I create a new Heroku app it gives me
https://obscure-plains-01212.herokuapp.com/
but this URL is not conventional to my app so I change the app name in the Heroku site buzzing-api and then Heroku gives me a new repository
https://git.heroku.com/buzzing-api.git
in stack its shows
Stack heroku-22 will replace Heroku-20 on the next deploy
So I try to re-deploy in my terminal but says
remote: ! No such app as obscure-plains-01212.
how can I add a new repository in the previous Heroku repository to avoid this error
You renamed the heroku app so your heroku repository url is also changed. But most probably you didn't change your heroku remote git url in your local project. Running these 2 commands should do the job:
git remote rm heroku
git remote add heroku https://git.heroku.com/buzzing-api.git

Heroku, triggering a deploy, after installing buildpacks [duplicate]

I would like to deploy a Heroku app which will be done ideally using git push -u heroku master. However this will only work if there are any pending commits to be pushed to master.
How can I redeploy the app while there is nothing to push ? I tried git push -u heroku master -f and still get the same below
Branch master set up to track remote branch master from heroku.
Everything up-to-date
PS: I also want to retain the existing app, which means I cannot make use of this answer https://stackoverflow.com/a/22043184/968442
Normally setting a config var causes your application to be restarted. In most situations there should be no need to redeploy after doing this.
If you really do need to trigger a new deployment you can add a new empty commit, then push to Heroku again:
git commit --allow-empty -m "Trigger Heroku deploy after enabling collectstatic"
git push heroku master
The new empty commit is a regular commit. It has a hash, an author, a timestamp, etc. It will have the same tree as its parent. This should cause Heroku to build your app slug again using the same code as the previous commit.
It's a bit awkward, but it works.
You can do it from UI as well!
Login to your Heroku dashboard and go to deploy section
Find Manual deploy option
Hit Deploy Branch button!
Note: you must have your app connected to GitHub for this option to be available (see comment from Derek below).
There is now also a plugin for the Heroku command-line that allows you to re-release the most recently deployed slug.
See https://www.npmjs.com/package/heroku-releases-retry
It turns out there is a neat plugin for Heroku called heroku release retry that lets you retry the last deploy without resorting to adding bad commits to your repository.
// install plugin
heroku plugins:install heroku-releases-retry
// retry release
heroku releases:retry --app {your-app}
Source: https://www.darraghoriordan.com/2019/03/02/heroku-push-failed-force-rebuild
You can run heroku restart --app app_name and you are good to go.
This worked for me, it did an actual build and release without any commit, contrary to one other post that only does a release:
heroku plugins:install heroku-builds
heroku builds:create --source-url https://user:token#api.github.com/repos/<username>/<repo name>/tarball/master/ --app <app-name>
Source: https://help.heroku.com/I3E6QPQN/how-do-i-force-a-new-deploy-without-adding-a-commit-to-my-github-repo
For stop the heroku app uses :
$ heroku ps:scale web=0
And for start it uses :
$ heroku ps:scale web=1

How to stop heroku build in progress

I accidentally added npm start in the heroku post build process so now the build progress is stuck.
I did git push heroku master the build started normal and my server started as it should when running npm start, but because the npm start was in the post build it never finished. Because I'm on free account I only have one concurrent build process and because of the one stuck I can't build new version.
I already tried heroku ps -a APP_NAME and then heroku ps:kill web.1 for the single process that was running, but it didn't help.
ty
Heroku has a CLI Plugin with which you can manage your builds.
heroku builds -a example-app # take note of the build ID you'd want to display
heroku builds:cancel <id> -a example-app
In case anybody reading this might still need it!

Deploy non-web Node app on heroku

I have a node app used only in a scheduler. But heroku keeps trying to call npm start on in.
State changed from starting to crashed
Process exited with status 1
State changed from crashed to starting
Starting process with command `npm start`
Even with a dummy worker in Procfile:
worker: echo 1
There's always a web process added at deploy:
Default types for Node.js -> web
Any ideas on how I could get rid of heroku continuously trying to npm start?
Not really a direct solution, but you could easily scale down your web processes to 0.
heroku ps:scale web=0

Deploy nodejs app heroku, error on git push

i am trying to deploy my application to Heroku, but, after have succesfully created the app, when i run in the shell the command
$ git push heroku master
the process doesn't start and after made me waiting some times it returns:
Initializing repositoryReceived disconnect from 50.19.85.132: 10: user closed connection
fatal: The remote end hung up unexpectedly
How can i solve this issue? I tried many ways but it seems i just can't deploy any app! Thank in advance

Resources