He used to report that the Prophet ﷺ said, "The sun and the moon do not eclipse for the death or life of anyone, but they are two of Allah's signs. When you see them eclipse, perform the prayer."
أنه كان يخبر عن النبي ﷺ قال: إن الشمس والقمر لا يخسفان لموت أحد ولا لحياته ولكنهما آيتان من آيات الله فإذا رأيتموهما فصلوا.
Bukhari narrated it in the Beginning of Creation (3201), and Muslim in the Eclipse (914:28), both through Abdullah bin Wahb, who said, Amr bin Harith informed me that Abdul-Rahman bin Qasim told him, on the authority of his father Qasim bin Muhammad, from Abdullah bin Umar, and he mentioned it. The wording given is Bukhari's, and Muslim's wording is similar.