Botframework-sdk: [Question] ES6 default import of builder not working in 3.8.4

Created on 19 Jun 2017  路  9Comments  路  Source: microsoft/botframework-sdk

System Information (Required)

  • SDK Language: Node
  • SDK Version: 3.8.4
  • Development Environment: Digital Ocean droplet, Ubuntu 16.04

Issue Description

I'm using an ES6 import to require the builder and some botbuilder imports, like this:

import builder, {Middleware, UniversalBot, IntentDialog, EntityRecognizer} from 'botbuilder'

This worked perfectly in 3.5.4, however since upgrading to 3.8.4, I get error messages saying TypeError: Cannot read property 'CardAction' of undefined (using like builder.CardAction). If I do console.log(builder) it comes out as undefined. All of the other non-default imports work perfectly. A short-term fix for this issue is to put any builder.Object item in the import, but I don't this is think sustainable going forward.

Code Example

import builder from 'botbuilder'

const connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_BOT_FRAMEWORK_ID,
appPassword: process.env.MICROSOFT_BOT_FRAMEWORK_SECRET
})

Cannot read property ChatConnector of undefined.

Expected Behavior

Default import of builder should be a defined object, which it was in 3.5.4 but appears to have broken in 3.8.4

Actual Results

  1. Cannot read property Object of undefined
  2. console.log(builder) // undefined

Most helpful comment

@macrozone @tomoakley use import * as builder from 'botbuilder'

All 9 comments

same problem here, seems to have stopped working. needed to roll back to 3.7.0

Confirmed, 3.7.0 works as expected, thanks @macrozone.

Use const builder = require('botbuilder'); instead of import.

Contributions welcome! Feel free to submit a pull request which includes the desired functionality.

@nwhitmont excuse me, but this is a regression. Is there a changelog that describes this breaking change? Please reopen this issue.

@nwhitmont still happens with 3.9.1. It's a undocumented breaking change.

using 'import' instead of 'require' should also be pretty standard these days.

@macrozone @tomoakley use import * as builder from 'botbuilder'

Any suggestion? Because it doesn't work for me in either 3.7.0 or 3.8.4 version.

import * as builder from 'botbuilder' this thing works but can anybody explain why import builder from 'botbuilder' is not working (I am using 3.14.1)? Acc to me, it should have worked as expected.

Was this page helpful?
0 / 5 - 0 ratings