500 Response from server when trying to solve gh files

Rhino.compute Server Error Analysis


I am experiencing issues with my rhino.compute server hosted on an Azure VM. When sending requests using Insomnia, the server responds correctly, but when running specific operations through my application, it results in a 500 Internal Server Error.

Application Setup

I have a Grasshopper file box.gh which has three number slider inputs named 1, 2, and 3, corresponding to dimensions: width, length, and height. Below is the relevant part of my application code:

@GeometryAndDataView("View Design", duration_guess=1, x_axis_to_right=True)
def uploaded_design(self, params, **kwargs):
    if params.upload_design_page.upload_design_tab.select_file_section.uploaded_file:
        compute_rhino3d.Util.url = os.getenv("RHINO_COMPUTE_URL")
        compute_rhino3d.Util.apiKey = os.getenv("RHINO_COMPUTE_API_KEY")

        input_trees = []
        tree1 = gh.DataTree("1")
        tree1.Append([{0}], [5])

        tree2 = gh.DataTree("2")
        tree2.Append([{0}], [5])

        tree3 = gh.DataTree("3")
        tree3.Append([{0}], [5])

        output = gh.EvaluateDefinition(
            str(Path(__file__).parent / '/gh_server_scripts/box.gh'),

        file = rhino3dm.File3dm()
        output_geometry = output['values'][0]['InnerTree']['{0}'][0]['data']
        obj = rhino3dm.CommonObject.Decode(json.loads(output_geometry))

        temp_file = tempfile.NamedTemporaryFile(suffix=".3dm", delete=False, mode="wb")
        file.Write(temp_file.name, 7)

        data = DataGroup()
        return GeometryAndDataResult(geometry=File.from_path(Path(temp_file.name)), geometry_type="3dm", data=data)
    return self.get_default_geometry(params=params)

The app crashes on the line output = gh.EvaluateDefinition(, as it is expecting a json response but finds none due to the 500 error code.

###Error details (Server logs an XML Parsing error)
    "MessageTemplate":"Connection id \"{ConnectionId}\", Request id \"{TraceIdentifier}\": An unhandled exception was thrown by the application.",
    "RenderedMessage":"Connection id \"0HN3IIQ6A2DK3\", Request id \"0HN3IIQ6A2DK3:00000001\": An unhandled exception was thrown by the application.",
    "Exception":"System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.",

Any help would be greatly appreciated!