Python code node issue

I’m experiencing an issue where a Python script that runs perfectly in the n8n Community Edition’s Code node fails in the n8n Cloud Edition. Specifically, in the Cloud version, the node (labeled as “Code in Python (Native)”) throws a “60 seconds runner error” (something like “Task request timed out after 60 seconds”). This seems to happen regardless of the input data size, and the workflow doesn’t execute the code at all.

For context, the code is designed to flatten an array of product variants from an input JSON structure, creating one output item per variant while preserving the parent product data. It worked without issues in my self-hosted Community Edition setup, but after migrating to Cloud, it consistently times out on the runner assignment.

Steps to Reproduce:

  1. Create a new workflow in n8n Cloud Edition.

  2. Add a “Code in Python (Native)” node.

  3. Paste the following Python code into the node:

    text

    # Flatten the items array - create one row per variant with all product data
    output = []
    for item in items:
        product_data = item.get('json', {})
        variants = product_data.get('items', [])
       
        # Create a copy of product data without the items array
        product_fields = {k: v for k, v in product_data.items() if k != 'items'}
       
        # Loop through each variant in the items array
        for variant in variants:
            # Combine product fields with variant fields
            row_data = product_fields.copy()
            row_data.update({
                'item_id': variant.get('item_id'),
                'item_sku': variant.get('item_sku'),
                'item_size': variant.get('item_size'),
                'item_size_value': variant.get('item_size_value'),
                'item_size_system': variant.get('item_size_system'),
                'item_stock': variant.get('item_stock')
            })
           
            output.append({
                'json': row_data
            })
    return output
    

This might be because in self hosted in the config yml you can set task runners and other settings. The cloud edition also might have a set limit of CPU and RAM usage, though how high I do not know.

Try doing 1 single item with a limit node set to 1 item on first, or 5 if you need several items.

i have a feeling like n8n is not allowing to use Python in code node in cloud variants. Is it correct?

You can but it’s more limited.