When You Don't Know How Your App Works

On Monday morning I was going through emails and see one from a user telling me the forgot password form isn’t working. That’s weird, it’s the kind of thing that doesn’t really break. I try resetting their password for them using the form, the form errors out. That’s weird. It turns out this user’s email address was capitalised, and the query code that fetches a user by email address sends in the lowercase value of their email.

Here’s what I did:

  1. Made the query case insensitive
  2. Made all emails lowercase before saving them in the database

After that I went to the UI to see if I could reset this user’s password. I tried to, but the form was unresponsive and the page refreshed every five seconds. What the hell? It didn’t seem related to anything I had been working on. I had a look at the Console and Network tabs in Google Chrome and could see the file __buildManifest.js and __ssgManifest.js were 404ing.

After some Googling I figured out they’re NextJS build related files. I had no idea why they were 404ing though. I tried reverting some code and doing some clean rebuilds on Netlify. The annoying thing was the bug seemed to happen about 10% of the time. Which meant it was really hard to determine whether anything I did fixed the bug. Luckily a lot of people use my app, and they send me messages and emails when something doesn’t work.

I tried to fix this bug up until Wednesday night. I was at Sydney airport a few hours before my flight trying to fix the bug. I still didn’t really know what was going on. I got on the plane and thought “Man I hope this bug is fixed when I land tomorrow morning”. And luckily it was.

Bank Statement Converter doesn’t have a very complicated UI. While I was on the plane I was thinking “Fuck it, just rewrite it in VanillaJS and HTML”. If the bug was still happening when I landed I probably would have started doing the rewrite.

NextJS is really cool, and has a lot of benefits. Unfortunately it’s very complicated. I don’t really know how it works. I suspect the bug was happening because some Netlify servers were serving up old versions of the UI. When something goes wrong in code I didn’t write, it’s very hard for me to figure out the problem. When something goes wrong in servers I don’t have access to, it’s very hard for me to solve the problem.

It’s probably a dumb idea, but the next time I make an app I’m going to try using VanillaJS.

Join The Mailing List