BennyKok/comfyui-deploy

TypeError: 'NoneType' object is not iterable erroe while running workflow

krn-briks opened this issue · 8 comments

I started getting issues with workflow_api since latest update, tried many options but no luck, can you tell whats causing this issue while running workflow from both UI and API.

Traceback (most recent call last):
File "/home/ComfyUI/compfyui/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
File "/home//ComfyUI/compfyui/lib/python3.10/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
File "/home/ComfyUI/compfyui/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
File "/home/ComfyUI/server.py", line 41, in cache_control
response: web.Response = await handler(request)
File "/home/ComfyUI/server.py", line 53, in cors_middleware
response = await handler(request)
File "/home/ComfyUI/custom_nodes/comfyui-deploy/custom_routes.py", line 193, in comfy_deploy_run
apply_random_seed_to_workflow(workflow_api)
File "/home/ComfyUI/custom_nodes/comfyui-deploy/custom_routes.py", line 100, in apply_random_seed_to_workflow
for key in workflow_api:
TypeError: 'NoneType' object is not iterable

Can anyone help with fixing this issue?

Error: workflow_api should be a dictionary.
Error: workflow_api is None or not a dictionary
Error handling request
Traceback (most recent call last):
File "/home/ComfyUI/compfyui/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
File "/home/ComfyUI/compfyui/lib/python3.10/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
File "/home/ComfyUI/compfyui/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
File "/home/ComfyUI/server.py", line 41, in cache_control
response: web.Response = await handler(request)
File "/home/ComfyUI/server.py", line 53, in cors_middleware
response = await handler(request)
File "/home/ComfyUI/custom_nodes/comfyui-deploy/custom_routes.py", line 214, in comfy_deploy_run
prompt_metadata[prompt_id] = SimplePrompt(
File "/home/ComfyUI/compfyui/lib/python3.10/site-packages/pydantic/main.py", line 175, in init
self.pydantic_validator.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for SimplePrompt
workflow_api
Input should be a valid dictionary [type=dict_type, input_value=None, input_type=NoneType]
For further information visit https://errors.pydantic.dev/2.7/v/dict_type
FETCH DATA from: /home/ComfyUI/custom_nodes/ComfyUI-Manager/extension-node-map.json

+1

same error here

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/content/drive/colab_ai/ComfyUI/server.py", line 42, in cache_control
    response: web.Response = await handler(request)
  File "/content/drive/colab_ai/ComfyUI/server.py", line 54, in cors_middleware
    response = await handler(request)
  File "/content/drive/colab_ai/ComfyUI/server.py", line 54, in cors_middleware
    response = await handler(request)
  File "/content/drive/colab_ai/ComfyUI/custom_nodes/comfyui-deploy/custom_routes.py", line 193, in comfy_deploy_run
    apply_random_seed_to_workflow(workflow_api)
  File "/content/drive/colab_ai/ComfyUI/custom_nodes/comfyui-deploy/custom_routes.py", line 100, in apply_random_seed_to_workflow
    for key in workflow_api:
TypeError: 'NoneType' object is not iterable

I'm running into this same issue.

Hi,

I have found a solution to the issue you're experiencing.

To resolve it, you need to modify the createRun.ts file located in the comfyui-deploy/web/src/server/ folder. Specifically, you should update the const shareData section.

Currently, it looks like this:

const shareData = {
  workflow_api: workflow_api,
  status_endpoint: `${origin}/api/update-run`,
  file_upload_endpoint: `${origin}/api/file-upload`,
};

You need to change workflow_api to workflow_api_raw:

const shareData = {
  workflow_api_raw: workflow_api,
  status_endpoint: `${origin}/api/update-run`,
  file_upload_endpoint: `${origin}/api/file-upload`,
};

After making this change, the application should run correctly.

Best regards

I get Error creating run, Unprocessable Entity {"detail":[{"loc":["body","input","workflow_api"],"msg":"field required","type":"value_error.missing"}]}

after doing this

any other changes ? @997172286

@BennyKok any ideas?