ComfyUI

Execute ComfyUI workflows

Overview

This node executes workflows designed for ComfyUI by sending the workflow JSON to a ComfyUI API endpoint. It is useful for automating image or video generation tasks defined in ComfyUI workflows, enabling integration of ComfyUI's capabilities into n8n automation pipelines.

Typical use cases include:

  • Automating complex image generation workflows.
  • Running video or GIF creation processes.
  • Integrating ComfyUI-generated media outputs into larger automation flows.

For example, a user can provide a JSON representation of a ComfyUI workflow that generates an image based on certain parameters, and this node will execute it remotely via the ComfyUI API, returning the generated images or videos as output.

Properties

Name Meaning
Workflow JSON The ComfyUI workflow described in JSON format. This defines the sequence of operations to be executed by ComfyUI.

Output

The node outputs an array of items where each item contains:

  • json object with metadata about each output file:

    • filename: Name of the output file.
    • type: Type of the output (e.g., "output", "temp").
    • subfolder: Optional subfolder path.
    • fileUrl: URL to access the file from the ComfyUI server.
    • filePath: Full path on the server (if available).
    • data: Base64-encoded string of the file content.
  • binary data containing the actual file content encoded in base64:

    • For images: JPEG or PNG format with appropriate MIME type.
    • For videos: MP4 or WebM format with appropriate MIME type.
    • Includes metadata such as file name, file size (in kB), file extension, and MIME type.

If downloading a file fails, the output includes an error message describing the failure.

Dependencies

  • Requires access to a running ComfyUI API endpoint.
  • Needs an API key credential for authentication with the ComfyUI API.
  • Uses the jimp library internally to process image files.
  • Requires proper configuration of the API URL and API key in the node credentials.

Troubleshooting

  • Common issues:

    • Failure to connect to the ComfyUI API (check API URL and network connectivity).
    • Invalid or missing API key causing authentication errors.
    • Workflow JSON parsing errors if the input JSON is malformed.
    • Timeout errors if the workflow execution takes too long or the API does not respond.
    • Missing outputs if the workflow does not produce any results.
  • Error messages:

    • "Failed to get prompt ID from ComfyUI": Indicates the API did not return a valid prompt ID after submitting the workflow. Verify the workflow JSON and API status.
    • "Workflow execution failed": The ComfyUI API reported an error during execution. Check the workflow logic and API logs.
    • "No outputs found in workflow result": The workflow completed but produced no output files. Confirm the workflow is designed to generate outputs.
    • "Execution timeout": The node waited too long for the workflow to complete. Consider increasing wait times or optimizing the workflow.
    • Network or download errors when fetching output files: Check network connectivity and file availability on the ComfyUI server.

Links and References

Discussion