Open y-yeah opened 4 years ago
Hi @y-yeah , please try version 3.14.0. Let me know.
@maryfs
Reproduced with :
Version : 3.15.0
(the error don't block the picker, but shown in console on first open)
I have the same (version 3.15.0)
Uncaught (in promise) TypeError: r.sent(...) is not a constructor at e.
Can confirm -- getting the same error on 3.1.0
Ok, marked as bug and will fix it soon.
Please fix this - it is very annoying. v3.16
Hey guys, I can't reproduce this bug, please send yours sample code and please check v3.17
This error happens consistently when uploading multiple files.
@MowiliMi @maryfs 3.17.0 has the same issue.
Looks like there is a problem with tslib.
@y-yeah please send your's pickerOptions, and sample implementations in react.
@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
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.
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}
/>
3.18 still has the issue.
Incredibly annoying as it does it repeatedly when resizing making it extremely slow to check responsiveness.
@thenderson55 @Kaeon please implements your's code with error on https://stackblitz.com/
Still have this issue on 3.20
Hi, we will be working on that issue soon. I will post updates here
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.
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.
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.
I see this happening randomly with 3.15.
After installing Airbrake we see this error constantly!
whats the latest here? It's been 2 years and this is still not supported?
This project seems dead.
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:
I'm using React + TypeScript with Chrome.