Changing the alert message for setting page, broke the validation for the userName

in this PR feat(client): change setting alert messages to more descriptive messages by Sboonny · Pull Request #49396 · freeCodeCamp/freeCodeCamp (, I tried to change the alert message into something more descriptive.

The issue is that changing the alert message broke the save API for validation, as shown in the gif below.

rec-tab (7)

  • the validation show that UserName isn’t avaliable which isn’t true.

But my code hasn’t interacted with createUpdateMyUsername. I have been looking at it for days, and I don’t know how I broke it.

The code that I changed, that can affect it, is this:

const createStandardHandler = (req, res, next, alertMessage) => err => {
  if (err) {
    return next(err);
  return res.status(200).json({ type: 'success', message: alertMessage });

const createUpdateUserProperties = (buildUpdate, validate, successMessage) => {
  return (req, res, next) => {
    const { user, body } = req;
    const update = buildUpdate(body);
    if (validate(update)) {
        createStandardHandler(req, res, next, successMessage)
    } else {

Here is the file for username, which has the validation in it.
freeCodeCamp/username.tsx at 168d403e417d05ec070c238c739ae63b5b824b0b · freeCodeCamp/freeCodeCamp (

How do I revert to the original behaviour, which displayed the alert correctly

Hey @Sboonny ,

I am unable to reproduce what you show in the gif. Have you fixed this?

Also, certifieduser is the username we use for the certified user:

Are you sure you do not have that user in the database? If you do, then it would not be available.

P.S. Remember, usernames are case-insensitive

Unfortunately, it is affected the tests feat(client): change setting alert messages to more descriptive messages · freeCodeCamp/freeCodeCamp@168d403 (

I thought the same thing and the test is flaky, but I have run the test 3 times and with the same result.

Here are more info, I should have included.

  • I have used Chrome while testing.
  • Actually I don’t know how to reproduce it consistently, all I know that I need to run npm run seed:certified-user, then copy and paste “CertifiedUser” (not type it).
  • running new Gitpod environment still create the same bug :disappointed: :face_with_head_bandage:

I still cannot reproduce:

I have open another gitpod environment with new database, and push a commit to the PR, hopefully the tests will be happy.

If the tests are happy, I will mess with the original environment seeing why this happened. :+1:

it was a typo in used string. :disappointed_relieved: