More information. If I publish using CloudDepoly on the output cell then all is well. It is when I use the publish button to publish the whole workbook that I get the issue.
SaveDefinitions -> True should do the trick, usually, but sometimes it’s more reliable to use the Initialization option of Manipulate to make sure all necessary definitions are made before the Manipulate tries to run.
If you include the a=2 definition in the Initialization and set SaveDefinitions -> True, it should work, I think. Unfortunately I don’t have time right now to give a better explanation than that, but I hope it works. You can always try to make the Manipulate in a notebook and see if it keeps working if you quit the kernel.