microsoft / microsoft/BotFramework-WebChat

direct-line-speech sample needs CORS fix

Open
#5,594 0 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 response

Is this an accessibility issue?

No response

What version of Web Chat are you using?

Latest production

Which distribution are you using Web Chat from?

Bundle (webchat.js)

Which hosting environment does this issue primarily affect?

Web apps

Which browsers and platforms do the issue happened?

No response

Which area does this issue affect?

No response

Which theme pack does this issue affect?

I did not test it on other theme packs

What is the public URL for the website?

https://github.com/microsoft/BotFramework-WebChat/blob/main/samples/03.speech/a.direct-line-speech/index.html

Please describe the bug

When running sample for directline to speech get this error:

Access to fetch at 'https://webchat-mockbot-streaming.azurewebsites.net/speechservices/token' from origin 'https://microsoft.github.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Do you see any errors in console log?
yes, this one:

Access to fetch at 'https://webchat-mockbot-streaming.azurewebsites.net/speechservices/token' from origin 'https://microsoft.github.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

and:

POST https://webchat-mockbot-streaming.azurewebsites.net/speechservices/token net::ERR_FAILED 500 (Internal Server Error)

and: 

TypeError: Failed to fetch
    at fetchCredentials (a.direct-line-speech/:42:29)
    at lj (webchat.js:2:3531402)
    at fj (webchat.js:2:3531974)
    at Object.R2 [as createDirectLineSpeechAdapters] (webchat.js:2:3995682)
    at a.direct-line-speech/:57:47
    at a.direct-line-speech/:70:9
How to reproduce the issue?
  1. Just open the sample: https://microsoft.github.io/BotFramework-WebChat/03.speech/a.direct-line-speech/
  2. Open browser devtools
What do you expect?

Working sample

What actually happened?

Blank page, no errors displayed on sample:

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

No response

Adaptive Card JSON

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 samples/03.speech/a.direct-line-speech/index.html and open the deployed sample with browser devtools to reproduce the failed request. Trace the fetch to the speechservices/token endpoint and identify the CORS failure; done means the sample loads without a blank page or blocked-token error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, html, javascript
Domain
cloud, frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.