Skip to content
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

FeatureLayerCollectionManager insert_layer() fails with unknown error #1814

Open
knoopum opened this issue Apr 25, 2024 · 9 comments
Open

FeatureLayerCollectionManager insert_layer() fails with unknown error #1814

knoopum opened this issue Apr 25, 2024 · 9 comments
Assignees
Labels

Comments

@knoopum
Copy link

knoopum commented Apr 25, 2024

I have successfully created an empty feature service with create_empty_service(). When attempting to add a layer to it with insert_layer, using a file geodatabase containing a single point feature class, it returns "Exception: Unknown Error (Error Code: 500)".

Inspecting the uploaded File Geodatabase and its resulting feature layer (hosted), they both look fine. And, when I examine the empty feature service, it does now have the expected layer in it. If I add it to map and add some points, it appears to be behaving correctly.

So I'm wondering what the error is about, and wether I should trust the feature service is correctly functional.

I've attached a zipped Notebook and File Geodatabase which can be used to reproduce the issue:

This is with ArcGIS API for Python version: 2.2.0.1

@knoopum knoopum added the bug label Apr 25, 2024
@nanaeaubry nanaeaubry self-assigned this Apr 26, 2024
@nanaeaubry
Copy link
Contributor

@knoopum
So what is happening in the insert layer method is that the file geodatabase gets added as an item and then published as an hosted feature item into your org. That is why when it fails you are left with that service.

The goal is to take the hosted feature layer and append it to your empty service and then remove that hosted service so you are left with the correct result.

What seems to be happening in the code is that when the analyze function is called it thinks your data is a csv for some reason. This is a bug on our end and we will put in a fix for it.
A possible workaround would be using the insert_layer method associated with the spatially enabled dataframe or to try a different file type...

Thanks for reporting

@nanaeaubry
Copy link
Contributor

@knoopum
When I try to publish the file geodatabase it is empty. Just FYI since you said it has one point:
image

@knoopum
Copy link
Author

knoopum commented Apr 26, 2024

@nanaeaubry correct, the feature class in file geodatabase is empty. I was trying to say that the file geodatabase contains a single feature class, which is of type point, rather than one point's worth of data in the feature class :)

@nanaeaubry
Copy link
Contributor

@knoopum Ok cool I didn't read that correctly my bad :) But we put in a small fix for the insert layer but the error remains and I wonder if it's because the file geodatabase is empty? When I try with a fgdb that has data in the same workflow as above (create empty feature service first), I don't get the error.
I will look into it more and report any updates but seems it is an error that Online is sending back even though everything seems to have been created correctly.

@achapkowski
Copy link
Contributor

@knoopum is this on online or enterprise? If enterprise, what version?

@knoopum
Copy link
Author

knoopum commented Apr 30, 2024

@achapkowski this is ArcGIS Online

@achapkowski
Copy link
Contributor

@knoopum so it's not a Python API issue, it's actually an AGO Rest issue. We can get the same behavior from the GUI. Can you please open a support case?

@knoopum
Copy link
Author

knoopum commented May 1, 2024

@achapkowski to verify for the support case, what is the error I should be reporting for AGO?

If I use the zipped file geodatabase attached to this thread, and go to my Content --> New item --> uploaded the zip file from my computer --> change the File type to File geodatabase --> add and create hosted feature layer, then I do not observe an error in the GUI. The end result is as expected, a hosted feature layer containing a point layer, and the latter has the desired fields, editor tracking and attachments enabled, and no data, as expected.

@nanaeaubry
Copy link
Contributor

@knoopum
In the GUI you add the filegeodatabase and it gets published. In the Python API you create an empty service first and then insert the data.
If you want to do the same as the GUI in the Python API you can do a content.add(...) call and then publish the item. This could avoid the error occurring from inserting the empty layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants