laptop and a wrench

Bug

Calling ArcPy StageService in ArcGIS Pro for a new layer returns the following error, "Selected layer does not contain a required layer type for web feature layer."

Last Published: May 14, 2020 ArcGIS Pro
Bug ID Number BUG-000130380
SubmittedApril 24, 2020
Last ModifiedFebruary 20, 2025
Applies toArcGIS Pro
Version found2.5
Operating SystemWindows OS
Operating System Version10.0 64 Bit
StatusKnown Limit

Additional Information

This issue is a technical limitation. The user has to save the .aprx file before trying to stage the service.

Workaround

  1. Add a new layer.
  2. Before the ArcPy CreateWebLayerSDDraft or StageService methods are called in the code, save the project in the code (or manually in ArcGIS Pro).

Below is an example:

aprx.save() 

# Replace out_sddraft path, service name and folder name 

arcpy.mp.CreateWebLayerSDDraft(map_or_layers=selected_layer,

         out_sddraft='C:/.../mydraft.sddraft',

         service_name='MyServiceName',

         folder_name='MyFolder',

         overwrite_existing_service=True,

         copy_data_to_server=True,

         enable_editing=True,

         allow_exporting=True,

         enable_sync=True)

# Replace paths

arcpy.StageService_server('C:/.../mydraft.sddraft', 'C:/.../mydraftsd.sd', 5) 

Steps to Reproduce

Bug ID: BUG-000130380

Software:

  • ArcGIS Pro

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options