Sahih al-Bukhari, Hadith 1283

Narrated Anas bin Malik: The Prophet passed by a woman who was weeping beside a grave. He told her to fear Allah and be patient. She said to him, "Go away, for you have not been afflicted with a calamity like mine." And she did not recognize him. Then she was informed that he was the Prophet. so she went to the house of the Prophet and there she did not find any guard. Then she said to him, "I did not recognize you." He said, "Verily, the patience is at the first stroke of a calamity."

حَدَّثَنَا آدَمُ، حَدَّثَنَا شُعْبَةُ، حَدَّثَنَا ثَابِتٌ، عَنْ أَنَسِ بْنِ مَالِكٍ ـ رضى الله عنه ـ قَالَ مَرَّ النَّبِيُّ صلى الله عليه وسلم بِامْرَأَةٍ تَبْكِي عِنْدَ قَبْرٍ فَقَالَ ‏"‏ اتَّقِي اللَّهَ وَاصْبِرِي ‏"‏‏.‏ قَالَتْ إِلَيْكَ عَنِّي، فَإِنَّكَ لَمْ تُصَبْ بِمُصِيبَتِي، وَلَمْ تَعْرِفْهُ‏.‏ فَقِيلَ لَهَا إِنَّهُ النَّبِيُّ صلى الله عليه وسلم‏.‏ فَأَتَتْ باب النَّبِيِّ صلى الله عليه وسلم فَلَمْ تَجِدْ عِنْدَهُ بَوَّابِينَ فَقَالَتْ لَمْ أَعْرِفْكَ‏.‏ فَقَالَ ‏"‏ إِنَّمَا الصَّبْرُ عِنْدَ الصَّدْمَةِ الأُولَى ‏"‏‏.‏

sunnah.com