Error pushing nodejs(express) app to heroku - node.js

I'm trying to push my nodejs(express) app to heroku using heroku push master.
I keep getting the following error:
App not compatible with buildpack:
https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz

when I participated at Node Knockout last year, I ran into the same problem.
Turned out I forgot to add a Procfile.
Do you have one? If so, could you share its content?

Related

error code=H14 desc="No web processes running" after trying to deploy Puppeteer app Heroku

I am trying to deploy a simple app to Heroku that performs Web Scraping using Puppeteer.
Since there's a problem using Puppeteer in Heroku, I needed to define a buildpack to support Puppeteer, following these articles:
Puppeteer unable to run on heroku
https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-on-heroku
https://github.com/jontewks/puppeteer-heroku-buildpack
Following these steps gave me the following error:
code=H14 desc="No web processes running"
after a bit of searching online, I found the following articles:
H14 error in heroku - "no web processes running"
saying that I have no web dynos running, and I have tried to set some up using the suggested command:
heroku ps:scale web=1
But that just gave me this error:
Scaling dynos... ! ▸ Couldn't find that process type (web).
I am running a Node.js app, using Yarn as the package manager.
What should I do?
I'll describe the process I've been through to solve this problem, which required a good amount of time.
First, I made sure that the problem is not caused by using Yarn instead of npm, according to Heroku documentation, if the root folder of your app contains yarn.lock file, then it automatically should use Yarn to build the app. But then they also say that you need to add to your package.json file a description of the version of Yarn your using, so I did:
"engines": {
"yarn": "1.x"
},
That was to make sure the problem is not yarn. which it wasn't.
Next, I have tried to understand exactly what the problem is with the web dynos, after a lot of searching I came across this:
https://help.heroku.com/W23OAFGK/why-am-i-seeing-couldn-t-find-that-process-type-when-trying-to-scale-dynos
This article also suggested using the heroku buildpacks:clear as the previous suggestion in the StackOverflow issue, but it said one more thing, super important:
Remove the existing Buildpacks...and add them again in the right order
What order? well... apparently that when I followed the previous StackOverflow issue, I have removed all the Buildpacks that came with the Heroku setup, including a very important one the heroku/nodejs build pack.
So I figured I have to re-add it to my Buildpack list. I also figured that if that is the default Buildpack that should be number one in the list, and the Buildpack for puppeteer should come after that (can be done by using the --index flag).
Finally, I solved the problems by running the following commands:
$ heroku buildpacks:clear
$ heroku buildpacks:add heroku/nodejs
$ heroku buildpacks:add --index=2 jontewks/puppeteer
$ git commit --allow-empty -m "Adjust buildpacks on Heroku"
$ git push heroku master
Running $ heroku buildpacks to confirm, returned the following:
=== workday-jobs Buildpack URLs
1. heroku/nodejs
2. jontewks/puppeteer
Now I know I have the necessary Buildpacks, in the right order, and it works!

buildpack error deploying node.js app to heroku - files seem to be at the correct level>?

I am getting an error in the screen shot bellow deploying a node.js app on heroku saying that the buildpack was unable to detect a node.js codebase
I set the build pack, the package.json is at the root level as is the app.js file
https://www.dropbox.com/s/y1bg6eir2w93m8a/Screenshot%202020-05-29%2013.44.36.png?dl=0
Not sure what I am doing wrong - thanks!!
The error is clear:
A Node.js app on Heroku requires a package.json.
In the files listed below, you can see that the package.json file is missing. You have to commit it and repush your code to Heroku.

Run heroku-cli command in heroku-based application

I'm trying to delete heroku application from another heroku web-appication
There is a bash-script: heroku apps:destroy ${APP_NAME} --confirm ${APP_NAME}
Locally it works fine because I have installed heroku-toolbelt; but on heroku-server I get an error: 'heroku: not found'
Is it possible to work with heroku-cli from heroku-based apps?
You can use the heroku toolbelt buildpack, which provides the toolbelt alongside your application:
https://github.com/gregburek/heroku-buildpack-toolbelt
You can also use the heroku API directly from your app:
https://devcenter.heroku.com/categories/platform-api

Heroku Buildpack Multi - no Cedar-supported app detected

I am trying to use PhantomJS with NodeJS in a worker process in Heroku, but when I switched to buildpack-multi, Heroku gives me this when I push:
-----> Fetching custom git buildpack... done
! Heroku push rejected, no Cedar-supported app detected
Here is my .buildpack:
http://github.com/heroku/heroku-buildpack-nodejs.git
http://github.com/stomita/heroku-buildpack-phantomjs.git
I also have a package.json in my root directory.
Your buildpacks file should be called .buildpacks, not .buildpack. See the detect script in ddollar/heroku-buildpack-multi to see what is needed for successful detection.

Is it possible to upgrade a Heroku app's buildpack after the app has been created?

I have an existing node.js app on heroku and I want to upgrade the node.js version by supplying a 0.6.7 buildpack.
Is it possible to update the buildpack a Heroku app is assigned?
If not, what is the suggested path for upgrading the builpack an app uses?
If I have to deploy a new app, how do I made sure the addons don't die?
Thanks,
Matt
This should be possible if you have a public git repo (e.g. a fork of https://github.com/heroku/heroku-buildpack-nodejs).
To update the buildpack you're using, set the BUILDPACK_URL config using the Heroku CLI:
heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-nodejs.git
(Note: replace the git URL with the URL of your buildpack.
heroku create myapp --buildpack https://github.com/heroku/heroku-buildpack-ruby
Previously you could set a config var for BUILDPACK_URL, this value will still be used if set, though a buildpack value set through the CLI will take precedence. BUILDPACK_URL as a config var is now deprecated in favor of the buildpack value on the API and in the future will be migrated.
Source: Heroku
From the Setting a Buildpack section of Heroku's buildpack documentation (June 2021)
Setting a buildpack on an application
You can change the buildpack used by an application by setting the buildpack value. When the application is next pushed, the new buildpack will be used.
$ heroku buildpacks:set heroku/php
Buildpack set. Next release on random-app-1234 will use heroku/php.
Run `git push heroku master` to create a new release using this buildpack.
You can also change it to a specific, unofficial one like this:
heroku buildpacks:set https://github.com/some/buildpack.git -a myapp
more details available on the linked page, which also includes information on how to set it when creating an app.

Resources