microsoft/BotFramework-DirectLineJS

Using from NodeJS - Unable to send attachments

kushalbhabra opened this issue · 5 comments

Hi, I'm using DirectLine JS 0.14.1 and trying to send attachment but getting an error from the library.

ReferenceError: FormData is not defined
    at MergeMapSubscriber.project (C:\Users\Kushal\Documents\code\nodejs-azure\b\smpls\samples\javascript_nodejs\13.core-bot\node_modules\botframework-directlinejs\lib\directLine.js:518:9)

I've also added below two lines in my application

global.XMLHttpRequest = require('xhr2');
global.WebSocket = require('ws');

Is there anything else to be done so that formdata and blob don't fail?

Originally posted by @kushalbhabra in #107 (comment)

@kushalbhabra, I've started attempting a repro of this issue. If you are able, could you attach a zipped copy of your project? Or, a simplified version if that is better.

Hi Stevkan

Here's a simplified version of my bot. When you say 'agent' it calls another bot using Directline secret in env file.

The functionality is emulate bot as proxy between user and agent hub for live agent transfer.

https://github.com/kushalbhabra/chat/blob/master/SampleDirectline.zip

@stevkan Let me know if you any more information to reproduce the issue

Hi @kushalbhabra, I am unable to repro the issue using the code you provided. I tested in both Emulator and Web Chat.

  • What client are you using for communicating with the bot?
  • What type of attachment are you trying to send?
  • And, is there a particular point in the dialog that the attachment is being sent or is it any time?
  • What version of Node do you have installed?
  • Does this occur for you if you upgrade the BotBuilder packages to 4.12.0?

Closing due to inactivity.