Rain fell upon the people during the time of the Prophet ﷺ, so he said, "Did you not hear what your Lord said tonight? He said, 'I do not bestow a blessing upon My servants except that a group among them disbelieve in it, saying, We were given rain by such and such a star. As for the one who believes in Me and praises Me for sending the rain, that is the one who believes in Me and disbelieves in the stars. And the one who says, We were given rain by such and such a star, that is the one who disbelieves in Me and believes in the stars.'"
أخبرنا قتيبة قال حدثنا سفيان عن صالح بن كيسان عن عبيد الله بن عبد الله
مطر الناس على عهد النبي ﷺ فقال ألم تسمعوا ماذا قال ربكم الليلة قال ما أنعمت على عبادي من نعمة إلا أصبح طائفة منهم بها كافرين يقولون مطرنا بنوء كذا وكذا فأما من آمن بي وحمدني على سقياي فذاك الذي آمن بي وكفر بالكوكب ومن قال مطرنا بنوء كذا وكذا فذاك الذي كفر بي وآمن بالكوكب
Bukhari transmitted it in the Book of Adhan, Chapter "The imam faces the people when he finishes the prayer," Hadith 846, and Muslim in the Book of Faith, Hadith 71. See also the preceding hadith narrated from Salih bin Kaysan, through the same chain. It is also found in Al-Kubra, Hadith 1834.Sufyan here is Ibn Uyayna, and from this route Ahmad transmitted it, 4/116, where he stated explicitly that he heard it directly.