microsoft / microsoft/BotFramework-WebChat
webchat.js:2 Uncaught SyntaxError: Invalid regular expression: /\p{P}/: Invalid escape
Nobody has claimed this yet.
- 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?
IFRAME
Which hosting environment does this issue primarily affect?
Electron
Which browsers and platforms do the issue happened?
Platform: Windows
Which area does this issue affect?
Development experience
What is the public URL for the website?
https://polarisbot-test.microsoft.com/
Please describe the bug
I am opening the bot using an iframe like this :
<iframe src={this.state.url} style={{ height: "100%", width: "100%", backgroundColor: "black" }}></iframe>
to open the bot in an electron application where the url is https://polarisbot-test.microsoft.com/
I consistently get this error on the console as provided below and then it is followed by this error
?mode=dark&copilot=fcshell:238)
at fire (jquery-3.6.0.js:3500)
at Object.fireWith [as resolveWith] (jquery-3.6.0.js:3630)
at done (jquery-3.6.0.js:9796)
at XMLHttpRequest.<anonymous> (jquery-3.6.0.js:10057)
I load the webChat.js this way in the bot code
<head>
<meta charset="UTF-8" />
<title>Polaris Bot</title>
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
</head>
and then I use the window.webchat like this
var directLine = window.WebChat.createDirectLine({
token: data.Token
});
console.log("window.webChat with directLine", directLine);
// render web chat widget that enables chatting with polaris bot
window.WebChat.renderWebChat(
{
directLine: directLine,
userID: activityUserId,
locale: 'en-US',
styleOptions,
overrideLocalizedStrings: {
TEXT_INPUT_PLACEHOLDER: 'Type your message here. Tip: type "help" to get the list of chat commands supported. type "cancel" or "quit" to end an ongoing dialog with me.'
}
},
document.getElementById('webchat')
);
Do you see any errors in console log?
webchat.js:2 Uncaught SyntaxError: Invalid regular expression: /\p{P}/: Invalid escape
at Module.51638 (webchat.js:2)
at r (webchat.js:2)
at Object.9316 (webchat.js:2)
at r (webchat.js:2)
at Object.67090 (webchat.js:2)
at r (webchat.js:2)
at Object.9998 (webchat.js:2)
at r (webchat.js:2)
at Object.34654 (webchat.js:2)
at r (webchat.js:2)
How to reproduce the issue?
I face this issue strictly when I use <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
in the header
When I change the script to use <script src="https://cdn.botframework.com/botframework-webchat/4.15.9/webchat.js"></script> it works again
What do you expect?
I need to get rid of this error message
It strictly occurs when I use the latest version and not 4.15.9
What actually happened?
When I load my electron application, I have a window on the left side which basically loads the iframe with the bot url .
But the bot never loads, instead it throws errors as provided in the description
Do you have any screenshots or recordings to repro the issue?
Adaptive Card JSON
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure in the Electron iframe using the latest CDN URL, then compare it with the working 4.15.9 URL. Start with the bundled webchat.js and the reported /\p{P}/ regular expression. Done means the latest Web Chat bundle loads without the syntax error and the bot renders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, javascript
- Domain
- desktop-dev, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100