js-file-downloader
js-file-downloader copied to clipboard
Download files using HTTPS throw error on console
I am using the latest version of this package minified for an internal project of the company I work and I noticed that when using HTTPS and trying to download files in different formats it throws an error on the console.
But this only happens on the first try, on the next's one the download proceeds correctly and no errors are shown.
Our source code that this happen is something like this
I enabled the nativeFallbackOnError to true and the error was
So I tried debugging this function and also the endpoint and it seems that after returning the file to download it cannot be read and the error.request.response is null and the responseText is filled with [Exception: DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'arraybuffer').

Hi @cfthody , are you sure this issue is not related to backend problem?
Yes, I'm sure. No error was found on the logs and also the BE was returning correctly the file(s) to download. But I can confirm again and attach the necessary screenshots to reinforce my statement.
Hii @AleeeKoi, sorry for the delay in answering.
I have done some tests again, and the BE is returning the array of bytes correctly. If it helps I have put a breakpoint on the catch to check the error and is related to the minified version of the lib.

Hi @cfthody , no worry. Could you please recreate this issue on codesandbox.io and share it with me? Thanks