botbuilder-python icon indicating copy to clipboard operation
botbuilder-python copied to clipboard

[on_turn_error] unhandled error: (MessageSizeTooBig) The request content length exceeded limit of 262144 bytes.

Open javeria-geek opened this issue 1 year ago • 2 comments

Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Version

botbuilder==0.0.1 botbuilder-core==4.16.1 botbuilder-dialogs==4.16.1 botbuilder-integration-aiohttp==4.16.1

Describe the bug

Getting the File size exceed error on pdf file upload using.

Expected behavior

Max file size limit is 2MB. The file I am trying to upload is 214KB. So, it should upload without error. Using the following approach:

conversation_id = turn_context.activity.conversation.id
                response = await connector.conversations.upload_attachment(
                    conversation_id,
                    AttachmentData(
                        name=os.path.basename(file_path),
                        original_base64=file_content,
                        type="application/pdf",
                    ),
                )

trace back

Traceback (most recent call last): File "D:\WorkSpace-PyCharm\Python Bot\env\lib\site-packages\botbuilder\core\bot_adapter.py", line 174, in run_pipeline return await self._middleware.receive_activity_with_status( File "D:\WorkSpace-PyCharm\Python Bot\env\lib\site-packages\botbuilder\core\middleware_set.py", line 69, in receive_activity_with_status return await self.receive_activity_internal(context, callback) File "D:\WorkSpace-PyCharm\Python Bot\env\lib\site-packages\botbuilder\core\middleware_set.py", line 79, in receive_activity_internal return await callback(context) File "D:\WorkSpace-PyCharm\cpaclientonboardingbot\bots\dialog_bot.py", line 38, in on_turn await super().on_turn(turn_context) File "D:\WorkSpace-PyCharm\Python Bot\env\lib\site-packages\botbuilder\core\activity_handler.py", line 70, in on_turn await self.on_message_activity(turn_context) File "D:\WorkSpace-PyCharm\cpaclientonboardingbot\bots\dialog_bot.py", line 53, in on_message_activity await run_main_conversation_flow(turn_context,self.obj_FlowAccesor,self.obj_PopulateDataModels) File "D:\WorkSpace-PyCharm\cpaclientonboardingbot\conversationalflow\create_conversational_flow.py", line 398, in run_main_conversation_flow response = await connector.conversations.upload_attachment( File "D:\WorkSpace-PyCharm\Python Bot\env\lib\site-packages\botframework\connector\aio\operations_async_conversations_operations_async.py", line 1133, in upload_attachment raise models.ErrorResponseException(self._deserialize, response) botbuilder.schema._models_py3.ErrorResponseException: (MessageSizeTooBig) The request content length exceeded limit of 262144 bytes.

##Similar issue https://www.google.com/search?q=why+cant+azure+bot+framework+upload+file+over+1MB&rlz=1C1UEAD_enUS1104US1104&oq=why+cant+azure+bot+framework+upload+file+over+1MB&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIJCAEQIRgKGKABMgkIAhAhGAoYoAEyCQgDECEYChigATIJCAQQIRgKGKABMgkIBRAhGAoYoAHSAQkxNzI4OGoxajeoAgewAgE&sourceid=chrome&ie=UTF-8

javeria-geek avatar Sep 12 '24 05:09 javeria-geek

@javeria-geek - Thank you for raising this to our attention. I have a couple questions, to start:

botbuilder==0.0.1

  • The version of the botbuilder package seems incorrect. Can you verify what is actually being installed / what you are running?
  • What channel are your users connecting thru to interact with your bot (e.g., DirectLine, Facebook, Slack, etc.)?

stevkan avatar Sep 13 '24 19:09 stevkan

@javeria-geek - Thank you for raising this to our attention. I have a couple questions, to start:

botbuilder==0.0.1

  • The version of the botbuilder package seems incorrect. Can you verify what is actually being installed / what you are running?
  • What channel are your users connecting thru to interact with your bot (e.g., DirectLine, Facebook, Slack, etc.)?

It is the same as, I am using "botbuilder-integration-aiohttp" mainly.

botbuilder 0.0.1 botbuilder-core 4.16.1 botbuilder-dialogs 4.16.1 botbuilder-integration-aiohttp 4.16.2 botbuilder-schema 4.16.1 botframework-connector 4.16.1 botframework-streaming 4.16.1

javeria-geek avatar Sep 16 '24 12:09 javeria-geek

@javeria-geek - Thank you for your patience. Are you still having an issue with this? If so, have you tried updating to version 4.16.2 for all packages?

And what channel / client are your users using (DirectLine, Facebook, Teams, etc.)?

botbuilder 0.0.1 Lastly, this library is not a Microsoft library. Considering it was last updating in 2016, I would suggest removing it. I can't guarantee that it isn't the cause of your issue as I have no idea what it is doing.

stevkan avatar Mar 28 '25 23:03 stevkan

Closing due to inactivity. Please feel free to reopen if the issue persists or you have new details to share.

stevkan avatar Apr 07 '25 23:04 stevkan