Make SDK - DataError - Invalid module output. Expected Object, but found Array

During a develpment of an App using Make SDK (integromat.com) I was getting the error:

DataError
Invalid module output. Expected Object, but found Array.

The module tries to use the feature of Multiple Requests to get all the information about a document in this specific API from two endpoints.

api.imljson
[
    {
        "url": "/v1/documents/{{parameters.uuid_doc}}/webhooks",
        "method": "GET",
        "response": {
            "temp": "{{ first(body) }}"
        }
        /**
        
        Response Example:
        [
            {
                "uuid": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
                "webhook_url": "https://hook.us1.make.com/..."
            }
        ]
        
         */
    },
    {
        "url": "/v1/documents/{{parameters.uuid_doc}}",
        "method": "GET",
        "response": {
            "output": "{{ merge( first(body), temp) }}"
        }
        /**
        
        Response Example:
        [
            {
                "uuidDoc": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
                "nameDoc": "DOC",
                "type": "application/msword",
                "size": "29184",
                "pages": "2",
                "uuidSafe": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
                "safeName": "Vault",
                "statusId": "2",
                "statusName": "Waiting",
                "statusComment": null,
                "whoCanceled": null
            }
        ]
        
         */
    }
]
expect.imljson
[
    {
        "name": "uuid_doc",
        "type": "uuid",
        "label": "Document ID",
        "required": true
    }
]

I tried to change the module type to Action and Action Type to Multipurpose and didn’t worked.

The solution after all was defining output for the first request:

api.imljson

[
    {
        "url": "/v1/documents/{{parameters.uuid_doc}}/webhooks",
        "method": "GET",
        "response": {
            "temp": "{{ first(body) }}"
            ,"output": "{{ first(body) }}"
        }
        /**
        
        Response Example:
        [
            {
                "uuid": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
                "webhook_url": "https://hook.us1.make.com/..."
            }
        ]
        
         */
    },
    {
        "url": "/v1/documents/{{parameters.uuid_doc}}",
        "method": "GET",
        "response": {
            "output": "{{ merge( first(body), removeKeys(temp, ['uuid']) ) }}"
        }
        /**
        
        Response Example:
        [
            {
                "uuidDoc": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
                "nameDoc": "DOC",
                "type": "application/msword",
                "size": "29184",
                "pages": "2",
                "uuidSafe": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
                "safeName": "Vault",
                "statusId": "2",
                "statusName": "Waiting",
                "statusComment": null,
                "whoCanceled": null
            }
        ]
        
         */
    }
]

Heya @AndyDaSilva52 :wave:

Thank you so much for jumping into #showcase and sharing what you discovered with us! :clap:

This is a great tip and I’m sure it will prove super helpful to folks searching for this kind of information in the future.

Thanks for keeping the community in mind :pray: