The Messenger of Allah ﷺ said, "The sun and the moon do not eclipse for the death of anyone or for his life, but they are two of the signs of Allah the Exalted. So when you see them, perform the prayer."
أخبرنا محمد بن سلمة قال أنبأنا ابن وهب عن عمرو بن الحارث أن عبد الرحمن بن القاسم حدثه عن أبيه
عن رسول الله ﷺ قال إن الشمس والقمر لا يخسفان لموت أحد ولا لحياته ولكنهما آيتان من آيات الله تعالى فإذا رأيتموهما فصلوا
Bukhari narrated it in the Book of Eclipse, Chapter on Prayer during a solar eclipse, hadith 1042, and Muslim in the Book of Eclipse, Chapter on the call for eclipse prayer "the prayer is being held in congregation," hadith 914, from the hadith of Ibn Wahb with the same chain. It is also in al-Kubra, hadith 1844.