Grasshopper files breaking on App Publish

Compute Server error after publishing app using .gh files in app directory

Hey there Dev Team, hope everyone is doing well today!

We are running into a problem where after publishing our app, the EvaluateDefinition function has started returning empty JSON due to a server error.

Application Structure

The basic structure of the application is:

  • VIKTOR frontend
  • Our Python code
  • Azure Compute Server
  • Our Python Code
  • VIKTOR frontend

In my development environment, everything works as intended. Here is an example of one of our pages in code:

parametrization = UploadPageParams(width=30)

@GeometryAndDataView("View Design", duration_guess=1, x_axis_to_right=True)
def uploaded_design(self, params, **kwargs):
    # Credentials for Rhino Compute
    compute_rhino3d.Util.url = os.getenv("RHINO_COMPUTE_URL")
    compute_rhino3d.Util.apiKey = os.getenv("RHINO_COMPUTE_API_KEY")

    input_dict = {
        "Loadfile_toggle": True,
        "uploadfiles_NOTCONNECTEDYET": worker.get_server_filepath(params.upload_design_page.upload_design_tab.select_file_section.dropdown_demo_select),
        "ArchiCAD_blocks": False,
        "CleanDoorsAndWindows": False,
        "search_pattern": '*##_*_##*',
        "location": params.upload_design_page.upload_design_tab.select_file_section.dropdown_location_select,
        "LocationIndex": 0

    input_trees = worker.build_input_trees(input_dict)
    appended_trees = worker.appened_settings(input_trees, 1, params.upload_design_page.upload_design_tab.select_file_section.dropdown_demo_select)
    # Evaluate the Grasshopper definition
    output = gh.EvaluateDefinition(

    storage = Storage()
    storage.set('upload_data', data=File.from_data(json.dumps(output)), scope='entity')

    mesh_list = worker.get_data_by_paramname(output, "previewgeometry")
    render_geom = worker.get_rhino3dm_from_mesh_list(mesh_list)

    import_report = worker.get_datagroup_from_paramname(output, "ImportReport")

    return GeometryAndDataResult(geometry=render_geom, geometry_type="3dm", data=import_report)

I decided to install Wireshark on the server so that I could look at the actual data coming through. I have uploaded them as “Working Request” and “Broken Request”. I noticed that the algo header in the working request is significantly longer than that of the broken request.

The Grasshopper definition files that I am trying to use exist inside of a directory in the app folder, called gh_server_scripts. The algo in the broken request is also different from that of the working request, but to my understanding, algo is supposed to be the actual script encoded when sent to the server. Could it be that after being uploaded, the file is being changed somehow?

In the Reports section for my app, I can see the lines:
File “/home/user/src/”, line 339, in uploaded_design
output = gh.EvaluateDefinition(
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
and I notice that the directory strcuture is different (seems to be some kind of linux) so I tried to publish with the --use-filesystem flag, but no dice sadly. I also tried changing the function to:

output = gh.EvaluateDefinition( str(Path('src/gh_server_scripts/')), appended_trees )

But this didn’t work either - any help would be much appreciated!

Thanks a ton for the help, Josh
Broken Request.txt (995 Bytes)
Working Request.txt (53.0 KB)

Hi @JoshuaCousins ,

I believe you are on the right path to solving your issue. Referring to the file path you’ve defined:

I would recommend making this file path relative. Refer to the documentation for more info on how to handle files:

Thanks a ton! Fixed it