Error [500] "Call to a Member Function getName() on Null" in Custom App Module for Invoice Upload

Hello Everyone,
I am developing a custom app and have created a module to upload invoices. The file input field is of type file, and I selected the type collection with data (buffer) and filename. However, when I test the module, I encounter the following error:

[500] Call to a member function getName() on null

I have double-checked the configuration and ensured that the input data is being passed as a collection containing both data and filename. Despite this, the error persists.





This is the API in postman :

Thanks (:smile:

I don’t think you are supposed to add both the filename and buffer parameter within a collection parameter, especially not with the spec directive. Maybe this results in the getName() function throwing an error, as the filename value cannot be accessed (which explains why it is null)

As far as I can see, there is no need to nest it either. So try to use the filename and data parameters in the top level object.

Cheers,
Henk

@Henk-Operative I changed them but still having the same issue



I also tried converting Data to binary and to base64 but it’s not working

Hi @Zainab_Fitian,

You also need to tell Make that the body should be encoded as multipart form in your Communication block. Add this to the Communication page:

"type": "multipart/form-data",

Make will then know to encode the body, and will also set the Content-Type headers for you.

The docs for this are here:

Kind regards, Terry.

1 Like

Hello @Terry_Hopper,
Thank you for your suggestion.
I added this ligne “type”: “multipart/form-data”, yesterday but the error didn’t change.
I don’t know if it’s related to the fact that the endpoint is expecting a file and not the name and data separated ? but I don’t know how to proceed :confused:

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