I've created a custom geoprocessing tool from a Python script that uses feature layers hosted on our Portal as inputs. The tool runs without issue when the local version is used, but when I publish the tool to Portal and try to use the hosted version in Pro or Portal it says it can't access the feature layer.
The feature layer is shared with our organization and the tool is currently private, but the account I'm using in Pro and Portal owns both. The layers and Portal both use HTTPS.
Has anyone ever come across this issue before? I'm at a loss on where to begin to troubleshoot it. I don't think the issue is with the script itself because it runs fine with the exact same inputs before the tool is published.
I am currently having the exact problem you describe. Maybe my story will help.
I have written a script to create a smoke plume from user inputs (it draws a giant triangle) and then update a number of structure features that are touched by the smoke plume. It works in ArcMap, but when I import it into a Portal App it fails without much explanation.
Now the code succeeds in drawing the plume, but fails in performing the highlights. After running the tool in my app I get a simple message: Submitted. Executing... Failed.
I originally wrote it with Update Cursors, but it sometimes complained about the editing session, so I did away with cursors and pivoted to " field calculator calls. Now it says it cannot locate the features to create a feature layer.
To make things more confusing I have a version of my tool that works, but it works by updating a single feature layer in the same feature dataset as the plume. This new tool works on several feature layers in a different feature dataset and it will not work at all. I have the old tool working fine, but it creates a problem for data maintenance in the future since the one feature is basically a child of the other features in the other feature dataset.
It seems to have trouble shifting from one feature dataset to another, so far as I can tell. It didn't work with update cursors, either - complaining that it couldn't get proper editing locks for the features in question. My old version works with update cursors, but my new version doesn't even need them to work. Both scripts work outside of Portal.
I since retried my script in a python toolbox (.pyt) format instead. This also has the same problem. Here is my stack exchange question: https://gis.stackexchange.com/questions/402157/custom-portal-gp-service-fails-for-unexplained-reason