It Works On My Machine 😅

The "It Works On My Machine" Paradox
So recently I was working on a feature that worked really well on my local machine and passed everything. Later, after a few days, we randomly thought of testing it in the dev environment… and it failed.
I got panicked because I had tested it many times locally. I had taken time to design the flow, build the architecture, and optimize the payload and now it failed in dev.
We immediately checked again on our local machines it worked. I was like, “Huh? What the heck just happened? Am I daydreaming?” 😅
So I went back to the dev server and tested it again. It failed 🥲
Checked the Git history did someone change anything? 🤔 Nope.
Then finally, I checked the database. And yep… there was one small schema difference that made all of us panic a column that was nullable locally wasn’t updated the same way in the dev DB.
Later, my senior (a Principal Engineer) gave us a tip:
“If it works perfectly on your local environment but fails in another environment and the code is the same, high chances the culprit is the database or environment differences.”
Small issue. Big lesson.