stream-chat-react icon indicating copy to clipboard operation
stream-chat-react copied to clipboard

bug: no way to disable file upload limit of 100mb when using our own upload process?

Open MatheoJaouen opened this issue 1 year ago • 5 comments

Describe the bug

A clear and concise description of what the bug is.

No way to disable size limit when using our own uploader? Trying in the app config to setup it too, still limited to 100mb image image related RN ticket, https://github.com/GetStream/stream-chat-react-native/issues/2617

I would prefer not to update the config either, adding an extra call at app launch etc. https://getstream.io/chat/docs/react/app_setting_overview/#file-uploads await client.updateAppSettings({

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A way to completely disable the file size limit when using our own uploader.

A clear and concise description of what you expected to happen.

Screenshots image

If applicable, add screenshots to help explain your problem.

Package version

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

Add any other context about the problem here.

MatheoJaouen avatar Aug 16 '24 17:08 MatheoJaouen

Hey @MatheoJaouen , you are probably using a function that uploads to the Stream's server right? Maybe you could perform the upload call with to your servers and then use the upsertAttachments function that can be accessed as follows:

const {upsertAttachment} = useMessageInputContext();

The function is not documented for v11 as it is officially presented in the v12 documentation. For v12 there are rc versions available (latest here).

MartinCupela avatar Aug 21 '24 11:08 MartinCupela

We upload everything to our own servers, we use our own uppy instance to our servers.

We pass a custom Input where we handle our custom upload then we use regular functions from hooks etc,

        <MessageInput<LandrChatGenerics>
            overrideSubmitHandler={overrideSubmitHandler}
            Input={MessageInputUI}

const messageInputContext = useMessageInputContext<LandrChatGenerics>();
            messageInputContext.fileOrder,
            messageInputContext.imageOrder,
            messageInputContext.text,
            messageInputContext.numberOfUploads,
            messageInputContext.handleChange,
            messageInputContext.handleSubmit,
            messageInputContext.uploadNewFiles,

The "bug" must have appear after a bump or if a default limit was set on your side?

The check is done here, which is used in useAttachment etc which is apparently core feature (then used for a lot of different stuff, upload preview etc etc etc). https://github.com/GetStream/stream-chat-react/blob/efbc08da0391845914e745bcdf0f8f32b7bc0869/src/components/MessageInput/hooks/utils.ts#L195

It would be better to have the possibility to disabled completely any limitation (files etc) from the dashboard directly or from the code when we use our own upload check/servers.

I did a patch meanwhile on the file to comment the checks but I'm sure others will face the same issue.

MatheoJaouen avatar Aug 23 '24 18:08 MatheoJaouen

Have you tried v12?

MartinCupela avatar Aug 23 '24 18:08 MartinCupela

Not yet (patch is so far easier than refactoring), But even if it does not go through the check it would be better to remove your default limits form the dashboard. Specifying GS servers only accepts file up to 100MB but let go other values

(I won't be able to reply before a week if ever)

MatheoJaouen avatar Aug 23 '24 18:08 MatheoJaouen

Hey @MatheoJaouen, you are running into this issue because of pervasive use of uploadNewFiles function that allows to upload only to Stream's infrastructure. It is then natural to check the file size limit, but it also forces you to override all the components that can possibly upload the files. We will change this so that you can override the uploadNewFiles function over MessageInput props without having to override all the components that use this function.

MartinCupela avatar Aug 26 '24 07:08 MartinCupela