I heard the solution has to be relatively believable within the confines of the story, and should have been properly set up before its used. So would God snapping his finger to save a group of protagonists would be totally ok if God was properly set up and his role explained and God is foreshadowed as a person who can save people? Or is it still a bad thing?
The problem with a deus ex machina is that it is not a satisfying resolution. So establishing there is a god (or device, or technique) that can do the required things is only part of the equation for making it work.
To make it satisfying, the protagonists need to earn it. If you're going with a literal deity, they need to win its favor. Maybe that's by doing a quest, or by pious devotion and unwavering faith. In any case, god shouldn't come to the rescue for no reason.
In most cases I think you'd also want the god to only put their thumb on the scale, tipping the balance in the heroes' favor, and not outright save them. As long as it still requires significant effort from the protagonists, then even if there was some divine help, it will be much more satisfying overcoming the obstacles in their path.
I think the only time ex-machina feels good is if the antagonist cheats.
Let's take a few stories where the antagonist kidnaps the princess and the protagonist wants to get her back.
Having the protagonist fail and then god snapping his fingers to get her back feels bad.
Having the antagonist agree to a baseball game and if the protagonist wins he can have the princess back feels good. So if the protagonist wins and he gets the princess back great.
Now imagine that, but after a hard fought game, and a squeaking by win the antagonist goes, "nah, I won't honor my agreement." Now having god step in whom we know likes baseball and fair play, and enforce the deal made earlier feels good.