microsoft / microsoft/BotFramework-WebChat

Wildcard route problem in sample `k.direct-line-token/javascript/web`

Open
#4,872 1 comment 0 reactions 1 assignee View on GitHub

@ram-xv is already working on this.

Since Sep 22, 2023.

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?

Unrelated

Which hosting environment does this issue primarily affect?

Web apps

Which browsers and platforms do the issue happened?

Browser: Edge (latest)

Which area does this issue affect?

Protocol or service

What is the public URL for the website?

No response

Please describe the bug

The wildcard route (/**/*) defined in index.js is causing an error due to improper formatting for Restify.

Do you see any errors in console log?
Error: Wildcard must be the last character in the route
    at Router._on (/Users/ram/Documents/bot/BotFramework-WebChat/samples/01.getting-started/k.direct-line-token/javascript/web/node_modules/find-my-way/index.js:266:15)
    at Router.on (/Users/ram/Documents/bot/BotFramework-WebChat/samples/01.getting-started/k.direct-line-token/javascript/web/node_modules/find-my-way/index.js:135:10)
    at RouterRegistryRadix.add (/Users/ram/Documents/bot/BotFramework-WebChat/samples/01.getting-started/k.direct-line-token/javascript/web/node_modules/restify/lib/routerRegistryRadix.js:42
:21)
    at Router.mount (/Users/ram/Documents/bot/BotFramework-WebChat/samples/01.getting-started/k.direct-line-token/javascript/web/node_modules/restify/lib/router.js:214:20)
    at Server.serverMethod [as get] (/Users/ram/Documents/bot/BotFramework-WebChat/samples/01.getting-started/k.direct-line-token/javascript/web/node_modules/restify/lib/server.js:1779:33)
    at Object.<anonymous> (/Users/ram/Documents/bot/BotFramework-WebChat/samples/01.getting-started/k.direct-line-token/javascript/web/src/index.js:31:10)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Object.nodeDevHook [as .js] (/Users/ram/Documents/bot/BotFramework-WebChat/samples/01.getting-started/k.direct-line-token/javascript/web/node_modules/node-dev/lib/hook.js:54:7)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
(node:68371) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
[ERROR] 00:06:17 Error: Wildcard must be the last character in the route
How to reproduce the issue?
  1. Navigate to k.direct-line-token/javascript/web root project directory.
  2. Resolve #4871 locally by adding asyn/await in post request handler
  3. Run npm start to start the server.
  4. The server fails to start, citing an issue with the wildcard route.
What do you expect?

The server should start without any errors and handle requests to all routes.

What actually happened?

Server startup failed due to the wildcard route issue in index.js.

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

No response

Adaptive Card JSON

No response

Additional context

Restify (or its underlying router) expects any wildcard * to be the last character in the route path.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.