Bulugh al-Maram 209
وَعَنْ عَامِرِ بْنِ رَبِيعَةَ - رضي الله عنه - قَالَ: كُنَّا مَعَ النَّبِيِّ - صلى الله عليه وسلم - فِي لَيْلَةٍ مَظْلَمَةٍ, فَأَشْكَلَتْ عَلَيْنَا الْقِبْلَةُ, فَصَلَّيْنَا. فَلَمَّا طَلَعَتِ الشَّمْسُ إِذَا نَحْنُ صَلَّيْنَا إِلَى غَيْرِ الْقِبْلَةِ, فَنَزَلَتْ: {فَأَيْنَمَا تُوَلُّوا فَثَمَّ وَجْهُ اللَّهِ} البقرة: ١١٥. أَخْرَجَهُ التِّرْمِذِيُّ وَضَعَّفَهُ.
From ʿAmir ibn Rabiʿah, may Allah be pleased with him, who said: We were with the Prophet ﷺ on a dark night, and the qiblah was unclear to us, so we prayed. When the sun rose, we found that we had prayed towards other than the qiblah. Then [this verse] was revealed: "So wherever you turn, there is the Face of Allah" (al-Baqarah 2:115). Reported by at-Tirmidhi, who graded it weak.