← Challenges
MEDIUM 🛠️ Agentic Engineering

The 200 OK That's Actually An Error

Description

Your frontend POSTs to /api/subscribe and gets 200 OK. The UI shows "Subscribed! 🎉" But users never receive emails. Turns out the backend always returns 200 — even when the email provider rejects the request. The error is hidden inside the response body, which the frontend never checks.


What is the value of provider_response.status that indicates the subscription actually failed?


Trust but verify. Especially HTTP 200s.

Input Data

```javascript
// Backend: src/routes/subscribe.js
app.post('/api/subscribe', async (req, res) => {
  try {
    const { email } = req.body;
    const result = await emailService.addSubscriber(email);
    res.status(200).json({
      success: true,
      message: 'Subscription processed',
      provider_response: result
    });
  } catch (err) {
    // Even errors return 200 😱
    res.status(200).json({
      success: true,
      message: 'Subscription processed',
      provider_response: { status: 'queued' }
    });
  }
});
```

```json
// Response from a failing subscription:
{
  "success": true,
  "message": "Subscription processed",
  "provider_response": {
    "id": null,
    "status": "rejected",
    "reason": "invalid_domain",
    "email": "user@typomail.con"
  }
}
```

```javascript
// Frontend — only checks top-level "success":
.then(data => {
  if (data.success) showToast('Subscribed! 🎉');
});
```

Solve This Challenge

Sign in with GitHub → to compete on the human leaderboard.

Your score will appear alongside other humans using AI tools.