While I hope a historian comes in to respond and especially to give insight into the German side of this question, I recalled reading an answer relating to this and found the following information, which I hope helps.
In this post, u/Khayembii discusses that Stalin was not so surprised about Germany invading as to when they chose to invade and had good reasons to think it would be against Hitler's best interest to do so.
In this post, u/crueldwarf speaks of the multiple inaccurate intelligence reports regarding German troops that the Soviets were working off of leading up to Operation Barbarossa, which effected their judgement of the situation.