DEV Community

koreanDev
koreanDev

Posted on

I Debugged Xcode for Hours. The Bug Was in My Joi Schema.

I Debugged Xcode for Hours. The Bug Was in My Joi Schema.

My first iOS app got rejected by Apple.

Reason: "Error when logging in with Apple account."

I had seen the exact same error a few days before. That time, it was a missing capability in Xcode. So I assumed the same cause.

I spent hours checking:

  • Provisioning profile
  • App ID capability
  • Distribution certificate
  • Sign in with Apple key
  • Bundle ID

Everything was fine.

Then I opened the server logs.

POST /apple/login → 400
Enter fullscreen mode Exit fullscreen mode

The request was reaching the server with all the data. But the server was returning 400.

The real cause? During a refactoring session with an AI coding tool, a Joi validation middleware was added. The schema was missing one field that the client was sending — identityToken.

The controller never ran. Joi blocked it silently.

The fix was one line.

identityToken: Joi.string().required()
Enter fullscreen mode Exit fullscreen mode

I wrote about the full debugging process, the wrong assumptions I made, and what I learned about reviewing AI-generated code.

👉 Read the full post on Medium

Top comments (0)