That’s Olber’s Paradox, of course, and it relies on three assumptions:
1. The universe is infinitely large and
2. The universe is filled with stars and
3. The universe has been this way forever.
It turns out #3 is wrong, so it’s still possible we live in an infinite universe.
(Imagine an infinite, unchanging universe filled with stars that magically popped into existence a billion years ago. You wouldn’t have a uniformly bright sky because even though every line of sight will theoretically terminate on a stellar surface, in most cases there hasn’t been enough time for light traveling along that line of sight — e.g. from a star 10 billion light years away — to reach your eyes.)