Another option for the spray foam is to use a second roof covering. Spray on the foam and then put up another roof on top of it, to protect the foam.
One of my grandfather's neighbors had an old-style flat roof (tar/gravel) and he sprayed on about 4 inches of foam on top. It was great until the foam cracked and started letting water run around inside the foam and collect on the old tar roof. Those tar roofs degrade over time so after a couple of years, the collecting water under the foam met a small crack in the tar, and the roof started leaking. The problem of course is that with both the tar roof and the foam covering, the inside evidence of the leak may be nowhere near where the actual roof leak because the water will run all through the cracks until it finds the final intrusion spot. So you can pour all the tar or foam sealant) into the cracks over the spot where the water is coming into the house, but the real leak may start in a tar or foam crack dozens of feet away.
The solution of course is, like all tar roofs, to re-tar the roof every few years and tear it all up and re-do the whole thing every decade or two. Once you add the foam though, you're pretty much hosed. Again, the "solution" to that is to put up a slanted tin roof up above the old roof, to minimize how much water ends up on the original foam and tar roof. That way even if some water gets onto the old roof through the tin roof, it usually isn't enough to leak through or collect enough to cause rot.
And of course all that is $$$, and doesn't even account for the fact that roofs and walls are designed to breathe to a certain degree, to avoid moisture buildup and mold throughout the house. Seal up the walls or roofs with additional treatments and you might trap moisture inside the house and cause any number of problems. It's the same sort of thing people find when they add radiant barriers inside their attics... Sure it drops attic temps and lowers heating/cooling costs, but the energy radiated back out the top of the roof can easily melt composite shingles and sealing tar, causing the roofing materials to fail much earlier than expected. The best solution I've seen is a double-roof structure that simply works as a second sun shade over the original roof, which remains the primary weather barrier. The second roof is pretty much open at the ends to allow ventilation between the layers and must be built to be easily removeable if/when the original or primary roof needs repair or replacing. The good news is that the top layer can be designed to help reduce hail damage on the primary roof and be easily repairable. Downside of course is cost, plus some insurance companies freak out over adding a roof on top of an existing roof if it isn't done exactly according to their specifications and that might make the house uninsurable or cause premiums and deductables to go way up.