filestack-js icon indicating copy to clipboard operation
filestack-js copied to clipboard

Mobile browser upload issue

Open thenderson55 opened this issue 3 years ago • 1 comments

Sometimes when I try uploading from my Samsung Android (version 10) phone using Chrome browser, it fails.

These are my pickOptions:

const pickOptions = (
  func: (img: string) => Promise<void> | void,
  setPicIsLoading:
    | React.Dispatch<React.SetStateAction<boolean>>
    | ((loading: boolean) => void) = () => {},
  setError: (message: string) => void = () => {}
) => {
  return {
    onFileSelected: (file: any) => {
      if (file.size > 4032 * 3024) {
        throw new Error(
          "ファイルが大きすぎます。1MB以下のものを選択してください。"
        );
      }
    },
    fromSources: ["local_file_system"],
    customText: photoPickerText,
    accept: ["image/*" /*"application/*"*/],
    transformations: {
      crop: {
        aspectRatio: 1,
      },
      rotate: true,
    },
    uploadInBackground: false,
    onUploadDone: async (res: { filesUploaded: { url: string }[] }) => {
      try {
        await func(res.filesUploaded[0].url);
      } catch (err) {
        setError(err.response.message || err.message || err);
      }
    },
    onCancel: () => {
      setPicIsLoading(false);
    },
    onFileUploadFailed: (err: any) => {
      console.log("FS ERROR", err);
      setError(err.response.message || err.message || err);
      setPicIsLoading(false);
    },
  };
};

Seems to throw this error:

Error: FS-Cannot upload file. Start request failed
    at new e (filestack.esm.js:41)
    at filestack.esm.js:41
    
Screenshot 2021-06-29 at 11 21 38

Sentry also throws it:

Screenshot 2021-06-29 at 11 22 40

thenderson55 avatar Jun 29 '21 02:06 thenderson55

Having same issue on my end

amitrahav avatar Dec 12 '22 13:12 amitrahav