Attachments with incorrect base64 contentUrl in sendActivity fails silently
See original GitHub issueVersions
What package version of the SDK are you using: 4.0.8 (botbuilder, botbuilder-dialogs) What nodejs version are you using: v.8.12.0 What browser version are you using: Chrome v69 What os are you using: Windows 10
Describe the bug
When trying to create an attachment that is intentionally corrupt (via an incorrect base64 url), the bot fails silently without throwing an error.
To Reproduce
- Create bot with command to trigger send activity with an attachment with the following code:
try {
console.log('Start');
await context.sendActivity({
type: 'message',
attachments: [{
contentType: 'text/plain',
contentUrl: 'data:image/png;base64,abc\nabc',
name: 'dot.png'
}]
});
console.log('Succeeded');
} catch (err) {
console.log(err);
throw err;
}
And on the BotFrameworkAdapter
instance, register an onTurnError handler like so:
adapter.onTurnError = async (context, error) => {
console.log(error);
await context.sendActivity(`Sorry, ran into an error!\n ${ error.message }`);
}
- Run bot, send command utterance to send activity
- Sending the command failed
Note that there is no error in the console, and the line
console.log("Succeeded");
is never reached. Similarly, onTurnError is never triggered.
The message fails silently, and after timing out, the Web Chat instance logs a 502 Bad Gateway error.
Sending other messages pass through successfully.
Expected behavior
Since the contentUrl is invalid, the bot should try and catch an error when this command is initiated.
[bug]
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Attachments with incorrect base64 contentUrl in sendActivity ...
The message fails silently, and after timing out, the Web Chat instance logs a 502 Bad Gateway error. Sending other messages pass through ......
Read more >Solved: Flow attachment Error - Power Platform Community
Error Message: 'The request content was invalid and could not be deserialized: 'Unexpected character encountered while parsing value: {. Path 'attachments[0].
Read more >Python: Ignore 'Incorrect padding' error when base64 decoding
It seems you just need to add padding to your bytes before decoding. There are many other answers on this question, but I...
Read more >Salesforce isn't handling Base64 Encoded attachments ...
I assumed that I would need to upload the file in base64 format, but this assumption appears to be wrong, OR Salesforce is...
Read more >3348 – Dealing with invalid base64 encoded emails
Subject: Re: New: base64 encoded html messages seem to confuse ... encoding of the text/html message Hrm. Well, the problem is that it's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@compulim should we consider redirecting this to DLJS?
Moved to DLJS repo. Confirmed with @ckkashyap that this is a platform problem.