简体   繁体   中英

Bot throws “Operation returned an invalid status code 'RequestEntityTooLarge'” exception when trying to send adaptive card in MS TEAMS channel

I am receiving the following error

"Operation returned an invalid status code 'RequestEntityTooLarge'"

when sending an adaptive card in Microsoft Teams channel.

I cannot find the max request body size allowed for a request in this channel anywhere. My whole request size is 70KB.

Has anyone run into this error before?

Is there a max request body size setting in Azure that I can adjust? I tried the same request from the Azure Web Chat and Bot Framework Emulator and it worked.

This is the request body I send

https://pastebin.com/8NTUKWan

using the TurnContext await command.TurnContext.SendActivitiesAsync(activities); activities argument is of type IMessageActivity[] .

Any suggestions as to why this is happening? The request body is not that large I am guessing maybe there is something else I am missing.

You are getting this error because your card is over the max size for a Teams message . Per Microsoft documentation , the size limit is approximately 28kb . You can see the GitHub issue here . It is under consideration for increasing the limit, but unfortunately there are currently no plans in place to increase the limit and there is no way to set the limitation higher. The GitHub issue contains some links at the bottom for voting up the increased limit on MS user voice.

The only workaround I know of is you can wrap the card in a task module , then that limit does not apply.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM