New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection using GIS("Pro") intermittently fails when running script #1752
Comments
@mappybird |
@nanaeaubry The script runs fine initially in a loop but it will randomly error out with the authentication error after a while. I am able to sometimes able to complete running the script with no errors. Worth noting that if I run it using a built-in account, the error does not appear. I also tried to rule out network issues by running the script on a machine on a different network but the error still persists. FYI, the script I'm running generates offline managed areas |
@mappybird You can try to edit the token expiration time to see if it makes a difference? Creating these offline managed areas take a while depending on size so maybe you are running into this issue? I can reach out to others and see if someone knows more about this behavior |
What form of security are you see this time out? |
I can try extending the token time in Portal, I thought the GIS('Pro') authentication method would've handled the negotiation for a token refresh when it returns an expired token but I'm unsure of the actual mechanism. Like I mentioned above, absolutely no issues when I use a built-in account. @achapkowski I am the owner of the WebMap Item and I am able to generate offline areas partially depending on when the authentication 'times out'. It's kind of a dice roll to be honest. |
@mappybird the issue is most likely with ArcGIS Pro and when it expires it's credentials. You can try using the arcpy method Signin to Portal method and pass your credentials at the top of your script. https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/signintoportal.htm |
The SignInToPortal method does not support SAML(or interactive logins). Am I out of luck here? |
I've done some further testing and and got an update: Using the following authentication method with a built-in account, it works without any issues : However, when the GIS('Pro') method of authentication was used, it errors outs with the following message regardless if you use a built-in account or SAML ( I initially thought built in might work but still failed when I attempted to run the script): A general error occurred: Could not login using Pro authencation. Please verify in Pro that you are logged in. Token expiry is sufficiently high in Portal so I'm a bit perplexed as to why it will fail intermittently. |
Describe the bug
Connection using GIS("Pro") intermittently fails when running script
To Reproduce
from arcgis.gis import GIS
gis = GIS("Pro")
for loop in loops:
Run loop to do something big
Screenshots
Expected behavior
Script runs without authentication error
Platform (please complete the following information):
Additional context
Just to be clear, this error happens intermittently when using the GIS("pro") method of connecting to ArcGIS Python API. There is also no traceback I can provide as it only outputs the error message above but still continues to run the loop (with more failures due to the GIS not being available anymore).
I can confirm that I'm logged into ArcGIS Pro when running the script and the Active portal is set. It's just odd that it happens intermittently and I was wondering how GIS("Pro") actually authenticates? Is it a matter of expired token and it fails to renew it?
The text was updated successfully, but these errors were encountered: