I created a python script tool and exported it as a web tool to use in the geoprocessing widget. It converts a selected layer to KML and exports it. The selection and input layer works fine, but when I export I get a URL to the exported KMZ location, and the URL fails with the error code below:
Here's the web tool code for reference:
I usually set my script output like this. Also make sure your parameter output type is set to something appropriate. In my case below I have a parameter with a Type of "Derived" and Data Type of "Feature Class". For you I am not sure if you will need the data Type of either "KML Layer" or "File". Might depend on if you are using the output as a map layer or just a straight download.
arcpy.GetParameterInfo()[5].value = buffers