Sahih Muslim , Book 4, Hadith 2013 (USC-MSA)

Anas b. Malik reported that Allah's Messenger came to a woman who had been weeping for her (dead) child, and said to her: Fear Allah and show endurance. She (not recognising him) said: You have not been afflicted as I have been. When he (the Holy Prophet) had departed, it was said to her that he was the Messenger of Allah, she was mortally shocked. She came to his door and she did not find doorkeepers at his door. She said: Messenger of Allah. I did not recognise you. He said: Endurance is to be shown at first blow, or at the first blow.

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

sunnah.com