Package
@slack/web-api
SDK Version
7.15.0
Node.js Version
20.14.0
Operating System
Windows 10
Steps to Reproduce
In Japanese Admin PowerShell terminal, run this file:
import bolt from "@slack/bolt";
const { App } = bolt;
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
appToken: process.env.SLACK_APP_TOKEN,
socketMode: true,
});
await app.start();
Expected Result
start without any errors
Actual Result
Failed with this error:
[WARN] bolt-app http request failed Invalid character in header content ["User-Agent"]
[WARN] bolt-app http request failed Invalid character in header content ["User-Agent"]
[ERROR] socket-mode:SocketModeClient:0 Failed to retrieve a new WSS URL (error: TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["User-Agent"])
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["User-Agent"]
at ClientRequest.setHeader (node:_http_outgoing:662:3)
at new ClientRequest (node:_http_client:289:14)
at Object.request (node:https:379:10)
at dispatchHttpRequest (C:\xxx\node_modules\axios\dist\node\axios.cjs:3072:21)
at C:\xxx\node_modules\axios\dist\node\axios.cjs:2732:5
at new Promise (<anonymous>)
at wrapAsync (C:\xxx\node_modules\axios\dist\node\axios.cjs:2716:10)
at http (C:\xxx\node_modules\axios\dist\node\axios.cjs:2790:10)
at Axios.dispatchRequest (C:\xxx\node_modules\axios\dist\node\axios.cjs:4101:10)
at async Axios.request (C:\xxx\node_modules\axios\dist\node\axios.cjs:4232:14)
at Axios.request (C:\xxx\node_modules\axios\dist\node\axios.cjs:4236:41)
at async C:\xxx\node_modules\@slack\web-api\dist\WebClient.js:476:34
at async run (C:\xxx\node_modules\p-queue\dist\index.js:163:29) {
code: 'ERR_INVALID_CHAR'
}
because process.title contains Japanese character like '管理者: Windows PowerShell' and bolt includes the character as a part of User-Agent in the below code.
https://github.com/slackapi/node-slack-sdk/blob/main/packages/web-api/src/instrument.ts#L21
Maybe this issue is the same origin (but maybe not Japanese but Korean) : slackapi/bolt-js#2772
Package
@slack/web-api
SDK Version
7.15.0
Node.js Version
20.14.0
Operating System
Windows 10
Steps to Reproduce
In Japanese Admin PowerShell terminal, run this file:
Expected Result
start without any errors
Actual Result
Failed with this error:
because
process.titlecontains Japanese character like'管理者: Windows PowerShell'and bolt includes the character as a part of User-Agent in the below code.https://github.com/slackapi/node-slack-sdk/blob/main/packages/web-api/src/instrument.ts#L21
Maybe this issue is the same origin (but maybe not Japanese but Korean) : slackapi/bolt-js#2772