It is used
to convey the idea that nothing is perfect, and even the most appealing or pleasant aspects of life may come with challenges or downsides; even beautiful or positive things can have their share of difficulties or drawbacks.
similar to
There is no rose without thorns.