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

Version 3.13 not working

Open y-yeah opened this issue 5 years ago • 24 comments
trafficstars

スクリーンショット 2020-04-04 22 02 34

Version 3.13 used in localhost throws this error so many times when trying to run the following code, while version 3.11.2 works properly:

import * as filestack from 'filestack-js';
const client = filestack.init('apikey');
const picker = await client.picker(pickerOptions);

I'm using React + TypeScript with Chrome.

y-yeah avatar Apr 08 '20 13:04 y-yeah

Hi @y-yeah , please try version 3.14.0. Let me know.

maryfs avatar Apr 22 '20 11:04 maryfs

@maryfs

Reproduced with :

Screenshot 2020-06-16 at 14 59 27

Version : 3.15.0

(the error don't block the picker, but shown in console on first open)

uplg avatar Jun 16 '20 12:06 uplg

I have the same (version 3.15.0) Uncaught (in promise) TypeError: r.sent(...) is not a constructor at e.

kaeon avatar Jun 25 '20 11:06 kaeon

Can confirm -- getting the same error on 3.1.0

utsavtiwary04 avatar Aug 03 '20 19:08 utsavtiwary04

Ok, marked as bug and will fix it soon.

maryfs avatar Aug 05 '20 09:08 maryfs

Please fix this - it is very annoying. v3.16

thenderson55 avatar Aug 06 '20 01:08 thenderson55

Hey guys, I can't reproduce this bug, please send yours sample code and please check v3.17

MowiliMi avatar Sep 17 '20 12:09 MowiliMi

This error happens consistently when uploading multiple files.

viperfx avatar Sep 17 '20 21:09 viperfx

@MowiliMi @maryfs 3.17.0 has the same issue.

Looks like there is a problem with tslib. スクリーンショット 2020-09-23 16 47 47

y-yeah avatar Sep 23 '20 07:09 y-yeah

@y-yeah please send your's pickerOptions, and sample implementations in react.

MowiliMi avatar Oct 01 '20 11:10 MowiliMi

@MowiliMi I have the issue in 3.17.0 with following pickerOptions: accept: (3) ["image/bmp", "image/jpeg", "image/png"] allowManualRetry: true container: "#filestackpicker" displayMode: "overlay" fromSources: ["local_file_system", "webcam", "googledrive", "onedriveforbusiness"] lang: "nl" maxFiles: 10 maxSize: 10485760 minFiles: 1 onFileUploadFailed: ƒ onFileUploadFailed(fileMetadata, error) onFileUploadFinished: ƒ onFileUploadFinished(fileMetadata) onUploadDone: undefined storeTo: {container: "", location: "s3", path: "/**///", region: "****"} uploadInBackground: false

kaeon avatar Oct 01 '20 14:10 kaeon

Hi @Kaeon , here's my sample app code:

import React from 'react';
import logo from './logo.svg';
import './App.css';
import ReactFilestack from 'filestack-react';


function App() {
  const options = {
    accept: ["image/bmp", "image/jpeg", "image/png"],
    allowManualRetry: true,
    displayMode: "overlay",
    fromSources: ["local_file_system", "webcam", "googledrive", "onedriveforbusiness"],
    lang: "nl",
    maxFiles: 10,
    maxSize: 10485760,
    minFiles: 1,
    uploadInBackground: false,
    maxFiles: 5,
  
};
  return (
    <div className="App">
     <ReactFilestack
    apikey='myApiKey'
    actionOptions={options}
    onSuccess={(res) => console.log(res)}
/>
    </div>
  );
}

export default App;

it uses by default, newest 3.17.0 js version, and react. Could you check if it works for you.. also please send me your sample app implementation in react.

maryfs avatar Oct 02 '20 06:10 maryfs

Hi @maryfs , I'm using custom Picker component, not react-filestack. I noticed now that the problem occurs only when I use the onFileUploadFinished property. Everything works but the console errors keep appearing.

const FsPicker = (props: FsPickerType) => {
  const { action, actionOptions, apiKey, buttonSize, buttonText, cropUrls, file, onError, onFileUploadFinished, onSuccess, security, source, type } = props;
  const { t } = useTranslation();

  const clientOptions = { security };
  const pickerOptions = {
    accept: ['image/bmp', 'image/jpeg', 'image/png'],
    allowManualRetry: true,
    container: '#filestackpicker',
    displayMode: PickerDisplayMode.overlay,
    fromSources: ['local_file_system', 'webcam', 'googledrive', 'onedriveforbusiness'], // TODOPHASE2 add onedrive (& dropbox) again as option and fix
    lang: 'nl',
    onFileUploadFinished,
    storeTo: {
      container: process.env.RAZZLE_S3BUCKET,
      location: 's3',
      path: '/',
      region: process.env.RAZZLE_S3REGION,
    },
    uploadInBackground: false,
  };
  const client = init(apiKey, clientOptions);
  const picker = client.picker({ ...pickerOptions });

  const completeAction = useCallback(() => {
    switch (action) {
      case 'crop':
        return picker.crop(cropUrls || []);
      case 'logout':
        return client.logout(actionOptions);
      case 'metadata':
        return client.metadata(source as string, actionOptions, security);
      case 'pick':
        return picker.open();
      case 'preview':
        return client.preview(source as string, actionOptions);
      case 'remove':
        return client.remove(source as string, security);
      case 'removeMetadata':
        return client.removeMetadata(source as string, security);
      case 'retrieve':
        return client.retrieve(source as string, actionOptions, security);
      case 'storeUrl':
        return client.storeURL(source as string, actionOptions, security);
      case 'transform':
        return new Promise((resolve, reject) => {
          try {
            resolve(client.transform(source, actionOptions));
          } catch (err) {
            reject(err);
          }
        });
      case 'upload':
        return client.upload(file, actionOptions);
      default:
        return picker.open();
    }
  }, [action, actionOptions, client, cropUrls, file, picker, security, source]);

  const onFail = useCallback(
    (error: any) => {
      if (typeof onError === 'function') {
        onError(error);
      } else if (error) console.error(error);
      else console.error('Filestack upload failed!');
    },
    [onError]
  );

  const onFinished = useCallback(
    (result: any) => {
      if (typeof onSuccess === 'function' && result) {
        onSuccess(result);
      }
    },
    [onSuccess]
  );

  useEffect(() => {
    if (type === 'immediate') {
      Promise.resolve(completeAction()).then(onFinished).catch(onFail);
    }
    () => {
      if (picker) picker.close();
    };
  }, [completeAction, onFail, onFinished, picker, type]);

  const onButtonClick = (event: any) => {
    event.stopPropagation();
    event.preventDefault();
    Promise.resolve(completeAction()).then(onFinished).catch(onFail);
  };

  if (type === 'button') {
    return (
      <Button onClick={onButtonClick} size={buttonSize}>
        {buttonText || t('button.selectpictures')}
      </Button>
    );
  }
  if (type === 'immediate') {
    return null;
  }
  return null;
};

<FsPicker
  type="button"
  maxFiles={maxPicturesForPortfolio}
  onFileUploadFinished={(fileMetadata: any) => {
    arrayHelpers.push({
      description: '',
      handle: fileMetadata.handle,
      tags: [],
    });
    validateForm();
  }}
  security={fsSecurity}
/>

kaeon avatar Oct 04 '20 06:10 kaeon

3.18 still has the issue.

Incredibly annoying as it does it repeatedly when resizing making it extremely slow to check responsiveness.

thenderson55 avatar Oct 06 '20 02:10 thenderson55

@thenderson55 @Kaeon please implements your's code with error on https://stackblitz.com/

MowiliMi avatar Oct 06 '20 09:10 MowiliMi

Still have this issue on 3.20

ColeWalker avatar Nov 20 '20 13:11 ColeWalker

Hi, we will be working on that issue soon. I will post updates here

pcholuj avatar Nov 20 '20 13:11 pcholuj

Has this been solved?

@ColeWalker we are not able to reproduce it, as @MowiliMi asked, please post a sample on https://stackblitz.com/ , otherwise we are stuck here. Use the newest version. Thanks.

maryfs avatar Feb 18 '21 12:02 maryfs

Really big bummer, this is occurring in my app right now. I wasted a bunch of time implementing against your API, only to find you have 3rd class support for the package. Bummer, you definitely lost my business.

andrewmartin avatar Mar 01 '21 03:03 andrewmartin

I see this happening randomly with 3.15. When the Amazon outage occurred in early December 2021 it was happening consistently. Seems as if the code is expecting the internal dependency to be loaded and it's not.

sshaw avatar Dec 13 '21 06:12 sshaw

I see this happening randomly with 3.15.

After installing Airbrake we see this error constantly!

sshaw avatar Jun 05 '22 02:06 sshaw

whats the latest here? It's been 2 years and this is still not supported?

jaxomlotus avatar Nov 24 '22 10:11 jaxomlotus

This project seems dead.

yoyosan avatar Nov 24 '22 13:11 yoyosan