Struggling to Launch n8n on Heroku Platform

Hey everyone, I’m having a tough time getting n8n up and running on Heroku. I’m not a tech whiz, so I could really use some help.

Here’s what I’ve done so far:

  1. Made a new Heroku app called heroku-app01
  2. Set up a Procfile with this command:
    web: n8n start --webhook-url=https://heroku-app01.herokuapp.com/
    
  3. Changed it to:
    web: node node_modules/n8n/bin/n8n start --webhook-url=https://heroku-app01.herokuapp.com/
    

But I’m still seeing ‘There’s nothing here, yet.’ when I go to the app URL. I’ve checked that n8n is in my package.json and that I’m using the right Node.js version.

When I look at the logs, I see this error: /bin/sh: 1: n8n: not found

I’ve tried restarting the dyno and even simplifying the Procfile to just web: n8n start, but no luck.

n8n works fine on my computer, so I think it’s something to do with Heroku. Can anyone help me figure out what I’m doing wrong? I’d really appreciate some step-by-step advice for a non-coder like me. Thanks!

hey, have u tried using docker with heroku? it can make deploying n8n easier. u could create a Dockerfile, push it to heroku container registry, and release it. might solve ur issue without messing with procfiles and stuff. just a thought!

I’ve been through a similar struggle with deploying n8n on Heroku, and I think I might have a solution for you. The issue likely stems from how Heroku handles Node.js applications.

Try modifying your Procfile to this:

web: npm start

Then, in your package.json file, add a start script:

"scripts": {
  "start": "n8n start --webhook-url=$WEBHOOK_URL"
}

Next, set the WEBHOOK_URL environment variable in your Heroku app settings to match your app’s URL.

Also, make sure you’ve set the correct buildpacks. You’ll need the Node.js buildpack and possibly the Puppeteer buildpack if you’re using any browser automation workflows.

Lastly, double-check that you’ve committed and pushed all changes to Heroku. Sometimes, local changes don’t reflect on the deployed app if not properly pushed.

If you’re still facing issues after trying these steps, it might be worth looking into the Heroku logs more deeply or considering a different hosting platform that’s more n8n-friendly out of the box.

I’ve encountered similar issues when deploying n8n on Heroku. One crucial step often overlooked is setting the correct environment variables. Make sure you’ve set NODE_ENV=production and N8N_PORT=$PORT in your Heroku config vars. Also, check if you’ve added the necessary add-ons like a database (PostgreSQL is recommended for n8n). If you’re still facing issues, consider using a custom buildpack specifically for n8n. There’s one available on GitHub that handles most of the configuration automatically. Lastly, ensure your Heroku stack is set to heroku-20 or later, as older stacks might not be compatible with the latest n8n version. If all else fails, reaching out to Heroku support or the n8n community forums could provide more specific troubleshooting steps.