Skip to content Skip to sidebar Skip to footer

How To Stop Heroku From Trying To Start Script With `npm Start`?

I am building a server-based application that runs a series of automated scripts (i.e., 'bots') in the cloud. I have provisioned an instance of Heroku Scheduler to automatically ru

Solution 1:

The solution had two parts for me. I solved the problem after implementing both parts.

Firstly, I had to turn off the npm start with the following terminal command as indicated in the edit to the OP.

heroku scale web=0

Secondly, I had to configure my buildpacks and puppeteer.launch() options to support running in the Heroku server environment as follows.

First, I clear all my buildpacks and then I added the puppeteer-heroku-buildpack and the heroku/nodejs one:

$ heroku buildpacks:clear$ heroku buildpacks:add --index 1 https://github.com/jontewks/puppeteer-heroku-buildpack$ heroku buildpacks:add --index 1 heroku/nodejs

Then, add the following args to the puppeteer launch function:

const browser = await puppeteer.launch({
  args : [
    '--no-sandbox',
    '--disable-setuid-sandbox',
  ],
});

Finally, deploy it back to Heroku:

$ git add .
$ git commit -m "Fixing deployment issue"
$ git push heroku master

The source of this second item is this SO answer.

Post a Comment for "How To Stop Heroku From Trying To Start Script With `npm Start`?"