Esri / hub-py

Python interface to ArcGIS Hub
https://github.com/esri/hub-py/wiki
Apache License 2.0
42 stars 13 forks source link

TypeError: Item is not a valid site or is inaccessible #123

Closed CJuice closed 2 years ago

CJuice commented 2 years ago

Around March 17, a long running hub site cloning process of ours began failing consistently. We had made no process changes.

Process clones a state government central Coronavirus site that definitely exists and is public and is available, no changes there. Though, the traceback says the item is not a valid site or is inaccessible.

After investigating it appears that the siteItem typeKeywords coming from ArcGIS Online (?) no longer contains the key "hubSite", though the arcgishub code looks for it. This causes a TypeError to be raised in the get() of class SiteManager in sites.py image

If we alter the siteItem typeKewords list to contain "hubSite", via a check for and then append(), the process runs successfully as it once did. As a side note, we only clone to two main items and not all the subpages. We have disabled page cloning by altering the class InitiativeManager add() to pages=False. At the time of initial development there were problems with the cloned pages so we disabled that functionality via... site = _initiative.sites.clone(site, pages=False, title=title)

The traceback from the failing process is as follows...

`Traceback (most recent call last): File "d:\scripts\covid_19_hubsitebackupprocess\src\arcgishub\arcgishub\hub.py", line 700, in clone site = origin_hub.sites.get(initiative.site_id) File "d:\scripts\covid_19_hubsitebackupprocess\src\arcgishub\arcgishub\sites.py", line 754, in get raise TypeError("Item is not a valid site or is inaccessible.") TypeError: Item is not a valid site or is inaccessible.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\Scripts\COVID_19_HubSiteBackupProcess\DoIT_CovidHubSiteBackupProcess\doit_Coronavirus_Hub_Cloning_Main.py", line 204, in main() File "D:\Scripts\COVID_19_HubSiteBackupProcess\DoIT_CovidHubSiteBackupProcess\doit_Coronavirus_Hub_Cloning_Main.py", line 147, in main title=f"{new_hub_title}") File "d:\scripts\covid_19_hubsitebackupprocess\src\arcgishub\arcgishub\hub.py", line 702, in clone raise Exception("Please provide origin_hub of the initiative object, if the initiative is not publicly shared") Exception: Please provide origin_hub of the initiative object, if the initiative is not publicly shared Exception in Task: Non zero exit code Exit code (1) description: Incorrect function.`

The process is run using Python 3.7 and arcgis module version 1.8.2, and arcgishub module version 2.1.0 pulled roughly 2 days ago Thanks.