Member-only story
The Unseen Deployment Puzzle: Why Heroku Won’t Deploy When Config Variables Are Involved
Have you ever encountered a situation where Heroku won’t deploy your application, even though everything seems to be in place? If yes, then this article is for you. I’ll unravel the mystery behind this deployment conundrum and provide a simple solution that works like a charm. ✨
7 min readDec 13, 2023
The Problem
It’s a chicken 🐔 and egg 🍳 problem:
- You can’t deploy a Heroku project because you’ve set the environment variables incorrectly.
- You can’t set the correct environment variables because the build fails.
I found this problem out when I was deploying a project for a client. I had set a stripe API key…or so I thought…
$ heroku config:set STRIPE_API_KEY=my_new_api_key
Setting STRIPE_API_KEY and restarting ⬢ my_app... done, v194
STRIPE_API_KEY: my_old_api_key
Oh, psssh. Heroku’s just messing with me. Of course the variable was set!
$ heroku config:get STRIPE_API_KEY
my_old_api_key