Best Way to run external code for heavy files?

I’m looking for advice on the best approach to handle heavy file processing without blocking my n8n workflows.

The Challenge

I need to process large media files (video/audio manipulation, image processing, etc.) that can take several minutes to complete. Running this directly in n8n would timeout or block other workflows.

What I’m thinking

  • Send file URL to external service

  • Process the heavy operations outside n8n

  • Get response back to continue the workflow

Questions

  • What’s the recommended architecture for this?

  • Should I use webhooks, polling, or message queues?

  • Any specific services or tools you’d recommend?

  • How do you handle error handling and retries?

Use case: Media manipulation (video transcoding, audio processing, large image operations)

Thanks in advance for sharing your experience! :folded_hands:

Hi @Paul_Taskmorphr

This is an interesting topic and we are keen to read other inputs from the community and do some knowledge sharing!

Our approach for handling heavy file processing in n8n would be using a decoupled architecture. This offloads the resource-intensive tasks to an external service, allowing your n8n workflow to remain responsive and avoid timeouts. Your thinking of sending a file URL to an external service is the path we will take.

We’ll explore several services for external processing and look at some key considerations.

Serverless Functions like (AWS Lambda, Google Cloud Functions, Azure Functions): These are a great choice for running code on-demand. You can write a function in a language like Python (with libraries like FFmpeg or Pillow) that takes a file URL as input, processes it, and then sends a webhook back to n8n.

Dedicated Media Processing APIs (Cloudinary, CloudConvert, Mux): These are purpose-built for media manipulation. You simply send them a file and they handle everything, often with built-in webhook support. This is the simplest option but can be more expensive.

Custom Microservice: If you have more complex needs, you can build your own microservice and host it on a platform like Docker or a simple VPS.

Error Handling: Implement retry logic on the n8n side for the initial call. Your external service should also have its own error handling, and a dedicated n8n error workflow can be triggered by the final webhook to send alerts.

Hope this helps! We’re looking forward to reading other inputs so we can all learn together.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.