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.

Direct Line does not work on Node.js based on current instructions

See original GitHub issue

#L549 contains a reference to a WebAPI-only constructors FormData and Blob which are not present in Node. This yields the error: ReferenceError: FormData is not defined. or ReferenceError: Blob is not defined.

The current README does not adequately describe the steps needed to use DirectLine in a Node app. Primarily the requirement for polyfills attached to the global object for both Blob and FormData.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
billbacommented, Nov 7, 2018

We’ve had a few people use this with Node, usually for proxy work like making Alexa work with Bot Framework bots via Direct Line.

@justinwilaby I believe there are polyfills out there for FormData and Blob which should let you use DLJS with Node.

0reactions
kushalbhabracommented, Feb 24, 2021

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Directline speech node js connection - Stack Overflow
I'm getting the html page with microphone and the speech is converted to text but when send that is not received in my...
Read more >
Node.js v19.3.0 Documentation
Command-line API ... Running npm install -g yarn doesn't work ... If your code is callback-based, it is enough to promisify it with...
Read more >
How To Work with Files Using Streams in Node.js - DigitalOcean
Streams are an efficient way to handle files in Node.js. In this tutorial, you'll create a command-line program, and then use it with ......
Read more >
Troubleshooting Azure Bot Service bots - Microsoft Learn
These frequently asked questions can help you to troubleshoot ... Why does my Direct Line 1.1 conversation start over after every message?
Read more >
Why the Hell Would I Use Node.js? A Case-by-case Tutorial
Additionally, Node.js is based on the open web stack (HTML, CSS, and JS), ... Note that these tools do not address the recovery...
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