The port now warns when NOTIFY_EMAIL is empty, as the Python check does. Next comes the retry count. On the new server, BACKUP_RETRIES is "5", so the check should promise six attempts, the first try plus five retries, and up to fifty minutes of retries at ten minutes each.
Every environment variable arrives as text in both languages, but they disagree about what happens when that text meets a number. Here you’ll see how one unconverted value produces two different results and where the conversion belongs.
Port the Retry Count
The Python check reads the variable with int(os.environ.get("BACKUP_RETRIES", "3")). That int() is there because Python insists on it. Without it, retries + 1 raises TypeError: can only concatenate str (not "int") to str on the first run, so a missing conversion can’t go unnoticed.
The first draft of backup-check.js read the variable with const retries = process.env.BACKUP_RETRIES;. JavaScript has no int() to carry over, and the draft ran without an error, so nothing pointed at the missing step. The snippet holds the new server’s value in a const so it runs anywhere. Predict what each line prints, or whether it fails:
const retries = "5"; // process.env.BACKUP_RETRIES
console.log(`Up to ${retries + 1} attempts`);
console.log(`Up to ${retries * 10} minutes of retries`);
There’s no error at all: