A man came to the Prophet ﷺ and said, "Messenger of Allah, last night while I was asleep I saw myself praying behind a tree. When I prostrated, the tree prostrated along with me, and I heard it saying, 'O Allah, record for me by it a reward with You, remove from me by it a burden, store it for me with You as a treasure, and accept it from me as You accepted it from Your servant Dawud.'"Hasan said, Ibn Jurayj told me, my grandfather told me, Ibn Abbas said, the Prophet ﷺ then recited a verse of prostration and prostrated.Ibn Abbas said, "I heard him saying the very same words the man had reported the tree as saying."
حدثنا قتيبة حدثنا محمد بن يزيد بن خنيس حدثنا الحسن بن محمد بن عبيد الله بن أبي يزيد قال قال لي ابن جريج يا حسن أخبرني عبيد الله بن أبي يزيد
جاء رجل إلى النبي ﷺ فقال يا رسول الله إني رأيتني الليلة وأنا نائم كأني أصلي خلف شجرة فسجدت فسجدت الشجرة لسجودي فسمعتها وهي تقول اللهم اكتب لي بها عندك أجرا وضع عني بها وزرا واجعلها لي عندك ذخرا وتقبلها مني كما تقبلتها من عبدك داود قال الحسن قال لي ابن جريج قال لي جدك قال ابن عباس فقرأ النبي ﷺ سجدة ثم سجد قال فقال ابن عباس فسمعته وهو يقول مثل ما أخبره الرجل عن قول الشجرة
Reference. Its isnad is hasan. Hakim also narrated it, 1/219, no. 2200, from the hadith of Muhammad bin Yazid, with the same wording, it will come later at no. 3424. Ibn Khuzayma graded it sahih, 1/282, no. 562, as did Ibn Hibban, no. 691, Khalili, and Hakim, and Dhahabi agreed with him.There is also a narration on this topic from Abu Saeed Khudri. Perhaps he is referring to the hadith of Ahmad, 3/84, which has another version with Abu Yaala, no. 1069, and others.