downloadResumable.downloadAsync() stopped working

Please provide the following:

  1. SDK Version: 44.0.0
  2. Platforms(Android/iOS/web/all): all
  3. Add the appropriate “Tag” based on what Expo library you have a question on. FileSystem

Good morning guys,
I have been using downloadResumable.downloadAsync() for some time now, and it has been working fine. All of a sudden the app users started complaining about downloads not working.
So I checked the code and the same error occurred.

Currently, I can download the same file with FileSystem.downloadAsync, but the same file doesn’t download with downloadResumable.downloadAsync.

downloadResumable comes back with this error file:

Bad Request

Bad Request - Invalid Header


HTTP Error 400. The request has an invalid header name.

The challenge s now is that with FileSystem.downloadAsync, I can’t see the progress of the file download, while I can see it with downloadResumable. Please what can I do.

Please check the link to the file below:
https://www.wabpreader.com.ng/images/compressed/BASIC SCIENCE and TECHNOLOGY BOOK 2 - U.M.O. Ivo Ayodele; T.C. Ogbuanya; I.T. Landu; David Omole.txt

downloadResumable code below:

    const downloadResumable = FileSystem.createDownloadResumable(
    fileLink,
    FileSystem.documentDirectory + ebookPath + ".txt",
    {
      headers: {
        "Content-Type": "*/*",
      },
    },
    callback
  );

  await downloadResumable
    .downloadAsync()
    .then(({ uri }) => {
      console.log("Finished downloading to ", uri);
      this._checkFile(ebookPath, title);
    })
    .catch((error) => {
      console.error(error);
    });

FileSystem.downloadAsync code below:

  const { uri } = await FileSystem.downloadAsync(
  fileLink,
  FileSystem.documentDirectory + ebookPath + ".txt"
  )
  .then(({ uri }) => {
    console.log("Finished downloading to ", uri);
    this.viewFile(uri, title);
  })
  .catch((error) => {
    console.error(error);
  });

Thanks
Tim

Did it suddenly stop working because of any changes to your app (e.g. updating the Expo SDK version, especially expo-file-system)? Maybe something on the server has changed and it stopped accepting some HTTP request headers?
Full HTTP request headers and response body logs would be useful here. Or at least the name of that unaccepted header

  1. Platforms(Android/iOS/web/all): all

Are you sure that it fails on all platforms?

Hi @barthap10 thanks so much for your reply. Your questions is giving me some idea on areas I have not considered, e.g. checking the server whether it stopped accepting HTTP request headers.
The problem actually started before I upgraded from expo 43.x.x to expo 44.0.0
I will consider all the tests. I will also try to get the full http request headers and response logs.
The surprise to me is that FileSystem.downloadAsync() downloads the same file, but downloadResumable started complaining of header error.
Also, I think saying all platforms bring error is an error on my part, I will correct it to only Android.
Thanks, I will get back to you.

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