question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attachments with incorrect base64 contentUrl in sendActivity fails silently

See original GitHub issue

Versions

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

  1. 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 }`);
}
  1. Run bot, send command utterance to send activity
  2. 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:open
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
corinagumcommented, Jan 25, 2019

@compulim should we consider redirecting this to DLJS?

0reactions
compulimcommented, Feb 8, 2019

Moved to DLJS repo. Confirmed with @ckkashyap that this is a platform problem.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found