Select to view content in your preferred language

Web Tool Error: Failed to read the output parameter (Code: 500)

65
1
yesterday
DavidT__
New Contributor

Hi all!

I am trying to create a custom web tool from a notebook but am receiving the following error when trying to execute:

DavidT___1-1767708463739.png

The end goal is to execute this web tool from Experience Builder and display output on the web map. I have tried executing the web tool from Experience Builder, a web map, and the REST URL of the web tool. The tool says it runs successfully in all three, but there is no output generated and the above error is returned.

I was able execute the same web tool in AGOL and successfully produce the expected output.

Below is example code that reproduces the error.

from arcgis.gis import GIS
from arcgis import create_buffers

gis = GIS('home')

# default vaule for input point
input_point = {
    'geometryType': 'esriGeometryPoint',
    'spatialReference': {
        'wkid': 4326
    },
    'fields': [
        {
            'name': 'id',
            'type': 'esriFieldTypeOID',
            'alias': 'ID'
        },
        {
            'name': 'Name',
            'type': 'esriFieldTypeString',
            'alias': 'Name'
        }
    ],
    'features': [
        {
            'geometry': {
                'x': -117.195695233,
                'y': 34.0560864,
                'spatialReference': {
                    'wkid': 4326
                }
            },
            'attributes': {
                'id': 2,
                'Name': 'Test'
            }
        }
    ]
}
distance = 2

buffer_areas = create_buffers(
    input_point,
    distances=[distance],
    units='Miles'
)

output_areas = buffer_areas.query()

# Inserted snippet writes output parameter file for web tool execution
import os
# Only run this snippet during web tool execution when env variable "ENB_JOBID" will be present
if "ENB_JOBID" in os.environ:
    out_param_name = "output_areas"
    out_param_file = os.path.join(
        os.environ["ENB_JOBID"], "value_" + out_param_name + ".dat")
    with open(out_param_file, "w") as writer:
        writer.write(str(output_areas))

 

I am using Enterprise 11.3 and Python 3 Advanced Runtime - 10.0

Also, if you know of any good documentation / tutorials for authoring web tools using Python, that would be greatly appreciated! I've been searching but haven't found anything too helpful yet.

Thanks in advance!

0 Kudos
1 Reply
David_McRitchie
Esri Regular Contributor

Hey David, 

Difficult to say from just a surface look but given its an error with the output parameter I would focus on lines 48, 55 - 56. Presumably there is something about the output object that cannot be reached or read.

I would agree with the resources, it can be difficult to find helpful guides. The following resource is a tad dated but the principles still remain and might be useful to you - https://mediaspace.esri.com/media/t/1_w3z627j3

I have a 11.3 test environment so will try test this later when I get a bit more time to sit down with it. 

Best of luck in the meantime,

David

Esri UK -Technical Support Analyst
0 Kudos