Skip to content

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

Closed
@javeria-geek

Description

@javeria-geek

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

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or an unintended behavior.needs-triageThe issue has just been created and it has not been reviewed by the team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions