Document upload - invalid image type

Hi,

I am having an issue with uploading image for document verification in sandbox environment. I am getting “Invalid file type” error. Here are the logs:

Everything works well through the Postman. When I use curl command and execute it from terminal it works, same for NodeJs using ‘request’ library, but when I try same thing with ‘axios’ or ‘follow-redirects’ I get “Ivalid file type” again.

Here is the code which does not work and I am using your documentation:

const stream = new Duplex();
stream.push(file.data);
stream.push(null);

// Create a form data object and append the file to it
const body = new FormData();
body.append("file", stream, {
      filename: file.filename,
      contentType: file.type,
      knownLength: file.data.length,
    });
body.append("documentType", type);

const uploadDocumentResponse = await dwollaClient.post(documentUrl, body);

I am using “dwolla-v2”: “^3.4.0” and “form-data”: “^4.0.0”.

What could be the issue here? Thanks

Hi @Vladimir_Ilic , Apologies for the delayed reply to your post. Were you able to get this working? I’m not seeing anything at first glance, but this post might help provide guidance on how this can be done with dwolla-v2-node and form-data.

Hi, I fixed it. Issue was caused by API Gateway REST API and Binary Media Type setting which had to be set to “multipart/form-data” and encode the buffer to “base64”. Code above was working before we switched from HTTP API to REST API

1 Like