In one embodiment, a method of treating cancer in a patient comprises administering cGAMP or cGAsMP to a patient having cancer and allowing the cGAMP or cGAsMP to treat the cancer. In another embodiment, a method for en2ymatically synthesizing and purifying cGAMP or cGAsMP comprises providing cGAS combining cGAS with ATP or ATP phosphorothioate, respectively, and GTP to produce cGAMP or cGAsMP separating cGAMP or cGAsMP from the cGAS and DNA by ultrafiltration and purifying cGAMP or cGAsMP using ion exchange chromatography and optionally gel filtration chromatography.