This is why they write software updates and patches.
Per a thread on Reddit, Severally user complaints have pointed to iPhone alarms failing to go off as scheduled:
Hijacking top comment. Check your battery settings and see if there is a gap during the night. Yesterday a lot of iPhones turned off for a few hours during the night. In my case the phone turned back on 1 minute before the alarm
A number of users also reported having to put in their passcodes in the morning, which could indicate that the iPhone, restarted, or shut off during the middle of the night.
You can tell if your iPhone turned off at night by opening up the Settings app, navigating to Battery, and checking the charging status over the past 24 hours. If there’s a gap, the iPhone was turned off for a period of time.
The problem seems to affect not only iPhone, 15 models, but other devices, suggesting that the issue may be a bug within iOS 17. Not all users are experiencing the shutdown issues, nor does it appear to be happening every night.
It is not yet clear what is going on, and Apple has not commented.