microsoft / microsoft/BotFramework-WebChat

Cannot import downscaleImageToDataURLUsingBrowser with 4.17.0

Open
#5,177 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bot Services bug customer-reported
Dominant language
HTML
Stars
1.8k
Forks
1.6k
Avg merge
22h 58m
Merged PRs (30d)
2

Description

Is it an issue related to Adaptive Cards?

No

Is this an accessibility issue?

No

What version of Web Chat are you using?

Latest production

Which distribution are you using Web Chat from?

NPM

Which hosting environment does this issue primarily affect?

Web apps

Which browsers and platforms do the issue happened?

Others or unrelated

Which area does this issue affect?

Development experience

Which theme pack does this issue affect?

I did not test it on other theme packs

What is the public URL for the website?

No response

Please describe the bug

Probably we're not supposed to be doing this, but it worked with versions <=4.16.0

We are using the downscaleImageToDataURLUsingBrowser function from botframework-webchat-component/src/Utils/downscaleImageToDataURL to generate thumbnail images for file attachments that are dropped on our webchat component via screengrab tool => copied to clipboard => pasted.

It looks as though the 4.17.0 release went live yesterday night or this morning on npm, and our builds started breaking on the line where we are doing:

import downscaleImageToDataURLUsingBrowser from "botframework-webchat-component/src/Utils/downscaleImageToDataURL";

With this error:

Module not found : error : Package path ./src/Utils/downscaleImageToDataURL is not exported from package 
{path-to-project}\node_modules\botframework-webchat-component (see exports field in 
{path-to-project}\node_modules\botframework-webchat-component\package.json) 

The only real difference I can see is that the index.js file changed to be index.ts

https://github.com/microsoft/BotFramework-WebChat/blame/f03d1f05ea6bb87dda6bea6ab42f58b1b96d9dfa/packages/component/src/Utils/downscaleImageToDataURL/index.ts#L6

This was probably not supposed to ever work, but it did through the crapulence of JavaScript and now it doesn't.

Do you see any errors in console log?

No response

How to reproduce the issue?
import downscaleImageToDataURLUsingBrowser from "botframework-webchat-component/src/Utils/downscaleImageToDataURL";
What do you expect?

Not to spend my whole day tracking down an undocumented build error.

What actually happened?

I had to explicitly set the version of botframework-webchat : 4.16.0 in my package.json

Do you have any screenshots or recordings to repro the issue?

No response

Adaptive Card JSON

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/component/src/Utils/downscaleImageToDataURL/index.ts and the botframework-webchat-component package.json exports field. Reproduce the documented deep import against version 4.17.0, then compare it with 4.16.0 to identify the package boundary change. Done means the intended use is either supported without the module-not-found error or clearly excluded from the package contract.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.