It was narrated that Ibn Dailami said:
"I was confused about this Divine Decree (Qadar), and I was afraid lest that adversely affect my religion and my affairs. So I went to Ubayy bin Ka'b and said: 'O Abu Mundhir! I am confused about the Divine Decree, and I fear for my religion and my affairs, so tell me something about that through which Allah may benefit me.' He said: 'If Allah were to punish the inhabitants of His heavens and of his earth, He would do so and He would not be unjust towards them. And if He were to have mercy on them, His mercy would be better for them than their own deeds. If you had the equivalent of Mount Uhud which you spent in the cause of Allah, that would not be accepted from you until you believed in the Divine Decree and you know that whatever has befallen you, could not have passed you by; and whatever has passed you by, could not have befallen you; and that if you were to die believing anything other than this, you would enter Hell. And it will not harm you to go to my brother, 'Abdullah bin Mas'ud, and ask him (about this).' So I went to 'Abdullah and asked him , and he said something similar to what Ubayy had said, and he told me: 'It will not harm you to go to Hudhaifah.' So I went to Hudhaifah and asked him, and he said something similar to what they had said. And he told me: 'Go to Zaid bin Thabit and ask him.' So I went to Zaid bun Thabit and asked him, and he said: 'I heard the Messenger of Allah (ﷺ) say: "If Allah were to punish the inhabitants of His heavens and of His earth, he would do so and He would not be unjust towards them. And if He were to have mercy on them, His mercy would be better for them than their own deeds. If you had the equivalent of Mount Uhud which you spent in the cause of Allah, that would not be accepted from you until you believed in the Divine Decree and you know that whatever has befallen you, could not have passed you by; and whatever has passed you by, could not have befallen you; and that if you were to die believing anything other than this, you would enter Hell"
English reference: Vol. 1, Book 1, Hadith 77
Arabic reference: Book 1, Hadith 81