I'm going to open a problem ticket on this - I'm opening this here also in case anybody has any good ideas.
I added a tool to my python toolbox that has a parameter of type GPFeatureLayer. The tool runs fine from ArcPro. When I try to share it to ArcGIS Online as a geoprocessing package, it fails with this error in the SharingJobLog.log file
ERROR 000966: The input layer is not valid ErrorMessage: ERROR 000966: The input layer is not valid
I create two trivial tools - The first with a GPString parameter and a GPFeatureLayer parameter, and no other code. The second exactly the same but with the GPFeatureLayer parameter removed. The second one shares OK, but the first on fails with the ERROR 000966.
I'm not seeing anything in the documentation that indicates GPFeatureLayer is not supported in a shared geoprocessing package, and I would hope that is not the case since it seems like a pretty basic requirement.
Here are the tool definitions I used to test:
class PackageTestWithLayer(object):
def __init__(self):
self.label = "0. Package Test - with layer"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
layer_param = arcpy.Parameter(displayName="GPFeatureLayer Input",
name="layer",
datatype="GPFeatureLayer",
parameterType="Optional",
direction="Input")
string_param = arcpy.Parameter(displayName="Text Input",
name="text",
datatype="GPString",
parameterType="Optional",
direction="Input")
return [layer_param, string_param]
def isLicensed(self):
return True
def updateParameters(self, parameters):
return
def updateMessages(self, parameters):
return
def execute(self, parameters, messages):
return
class PackageTestWithNoLayer(object):
def __init__(self):
self.label = "0. Package Test - no layer"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
string_param = arcpy.Parameter(displayName="Text Input",
name="text",
datatype="GPString",
parameterType="Optional",
direction="Input")
return [string_param]
def isLicensed(self):
return True
def updateParameters(self, parameters):
return
def updateMessages(self, parameters):
return
def execute(self, parameters, messages):
return
I'm running this on ArcPro 2.4.3 and Python 3.6.8 and Advanced license.
Solved! Go to Solution.
Update: My tool is designed to work with a web layer as the input - the user goes to the Portal tab and drags an ArcGIS Online REST endpoint onto the contents tab - then drags one of the layers into the input field. I discovered that if I drag a layer whose datasource is the enterprise database server then I can share the trivial tool no problem. So I'm concluding that the problem is using the web layer. Unfortunately I can't easily change my tool to work with the database because then it gets packaged up with tool when I share it which I can't let happen for security reasons.
Update: My tool is designed to work with a web layer as the input - the user goes to the Portal tab and drags an ArcGIS Online REST endpoint onto the contents tab - then drags one of the layers into the input field. I discovered that if I drag a layer whose datasource is the enterprise database server then I can share the trivial tool no problem. So I'm concluding that the problem is using the web layer. Unfortunately I can't easily change my tool to work with the database because then it gets packaged up with tool when I share it which I can't let happen for security reasons.
I confirmed that this is the cause of the problem.