Johann Sebastian Bach died probably from a combination of three different factors. He probably suffered from diabetes, plus he was absolutely devitalized and the rest is due to a stroke, it's unclear whether the stoke that caused his death was a first or a second one.
Let's start earlier in Bach's life. It seems Bach suffered from a bad sight for his whole life, what didn't bother him creating music. Maybe without that challenge, his work would have even been greater. Just kidding. Almost nobody knows that the most competent Bach scientist assumes, that the 1,128 works, that Bach created and which are preserved are only ten percent of the life work of the Thomas Cantor.
However, back to Bach's health life. Bach became blind in 1750. Today they assume, the cause is an undiscovered diabetes, but it would have made no difference, if they had discovered the diabetes back then. As effective treatment of diabetes was not known back in 1750. Other Bach biographers however believe, Bach's death was caused by a first and a second stroke.
Exactly at that time, when Bach became blind, a famous British occultist, an eye doctor, was on a trip in Leipzig. Those experts made trips back then and treated patients all over Europe. John Taylor operated on Bach. However, the first time without any success. So he operated on him a second time. Again there was no success. However that was not the responsible detail which is related to Bach's fading health. Because he couldn't see before and after the surgery. Otherwise Bach was fine. But his general health got worse and worse, due to the catastrophic treatment back then coming with the surgeries. Plus, because of missing medication, which is common to have today. As there was no helping medication around, bleeding as a treatment sent a weak and ill person out of the frying pan into the fire. So, Bach suffered for half a year after these two surgeries. Not only the missing health, but as well the impositioned rest and inaction weren't definitely helpful for his health. Whether, like nowadays science tells for the last year Bach suffered from diabetes or the blindness is due to a stroke, is surely of no importance. Both alternatives wouldn't have changed as a threat with a successful surgery.
Curiously Johann Sebastian Bach suddenly, half a year after his second operation, was able to see again. Just to suffer a second stroke (... when a first stroke caused the blindness six months earlier) or, well a first stroke, which weakened Bach terminally. He was still living for ten days, before he finally died.