WEIXIN CHANNEL: get_qrcode_status still missing iLink-App-Id header causes login failure (v0.14.2)
Summary
PR #2943 fixed the missing headers in buildHeaders() (api.ts), but the QR code login flow in waitForLogin() (login.ts) still sends incomplete headers to /ilink/bot/get_qrcode_status, causing authentication failure and inability to connect.
Affected Version
v0.14.2 (latest stable), also v0.14.1
Root Cause
PR #2943 only modified api.ts → buildHeaders(), adding iLink-App-Id and iLink-App-ClientVersion to normal API requests (getUpdates, sendMessage, getConfig).
However, the QR code login flow in login.ts → waitForLogin() has its own fetch call to /ilink/bot/get_qrcode_status with a hardcoded header object that was NOT updated by PR #2943:
// packages/channels/weixin/src/login.ts — waitForLogin()
const resp = await fetch(`${apiBaseUrl}/ilink/bot/get_qrcode_status?qrcode=${encodeURIComponent(currentQrcodeId)}`, {
headers: { "iLink-App-ClientVersion": "1" }, // WRONG: missing "iLink-App-Id": "bot"
signal: controller.signal
});
Additionally, "iLink-App-ClientVersion": "1" is incorrect. It should use the same buildClientVersion(ILINK_PROTOCOL_VERSION) as buildHeaders() to produce the proper encoded version number (e.g., 131331 for version 2.0.0).
Symptoms
- Run
qwen channel configure-weixin
- Scan QR code with WeChat and confirm
- The
waitForLogin poll loop fails silently (HTTP error or empty response)
account.json is never generated
- Service cannot start with error:
WeChat account not configured
Even if you manually create account.json, the service starts but the poll loop immediately returns errcode: -14 (session timeout) because the same missing headers affect downstream API calls.
Complete Fix
Two locations need to be fixed:
Fix 1: login.ts → waitForLogin() headers (THIS IS STILL BROKEN)
// BEFORE (current v0.14.2):
const resp = await fetch(`${apiBaseUrl}/ilink/bot/get_qrcode_status?qrcode=${encodeURIComponent(currentQrcodeId)}`, {
headers: { "iLink-App-ClientVersion": "1" },
signal: controller.signal
});
// AFTER:
const resp = await fetch(`${apiBaseUrl}/ilink/bot/get_qrcode_status?qrcode=${encodeURIComponent(currentQrcodeId)}`, {
headers: {
"iLink-App-Id": "bot",
"iLink-App-ClientVersion": String(buildClientVersion(ILINK_PROTOCOL_VERSION))
},
signal: controller.signal
});
Fix 2: api.ts → buildHeaders() (already fixed in PR #2943, no action needed)
function buildHeaders(token?: string) {
const headers = {
"Content-Type": "application/json",
"X-WECHAT-UIN": randomUin(),
"iLink-App-Id": "bot",
"iLink-App-ClientVersion": String(buildClientVersion(ILINK_PROTOCOL_VERSION))
};
if (token) {
headers["AuthorizationType"] = "ilink_bot_token";
headers["Authorization"] = `Bearer ${token}`;
}
return headers;
}
Verification
After applying Fix 1, the full login flow works:
qwen channel configure-weixin → QR code generated
- Scan + confirm in WeChat →
waitForLogin successfully gets bot_token
account.json generated with valid token
qwen channel start my-weixin → Connected, poll loop running normally
Related
WEIXIN CHANNEL:
get_qrcode_statusstill missingiLink-App-Idheader causes login failure (v0.14.2)Summary
PR #2943 fixed the missing headers in
buildHeaders()(api.ts), but the QR code login flow inwaitForLogin()(login.ts) still sends incomplete headers to/ilink/bot/get_qrcode_status, causing authentication failure and inability to connect.Affected Version
v0.14.2 (latest stable), also v0.14.1
Root Cause
PR #2943 only modified
api.ts→buildHeaders(), addingiLink-App-IdandiLink-App-ClientVersionto normal API requests (getUpdates, sendMessage, getConfig).However, the QR code login flow in
login.ts→waitForLogin()has its ownfetchcall to/ilink/bot/get_qrcode_statuswith a hardcoded header object that was NOT updated by PR #2943:Additionally,
"iLink-App-ClientVersion": "1"is incorrect. It should use the samebuildClientVersion(ILINK_PROTOCOL_VERSION)asbuildHeaders()to produce the proper encoded version number (e.g.,131331for version2.0.0).Symptoms
qwen channel configure-weixinwaitForLoginpoll loop fails silently (HTTP error or empty response)account.jsonis never generatedWeChat account not configuredEven if you manually create
account.json, the service starts but the poll loop immediately returnserrcode: -14(session timeout) because the same missing headers affect downstream API calls.Complete Fix
Two locations need to be fixed:
Fix 1:
login.ts→waitForLogin()headers (THIS IS STILL BROKEN)Fix 2:
api.ts→buildHeaders()(already fixed in PR #2943, no action needed)Verification
After applying Fix 1, the full login flow works:
qwen channel configure-weixin→ QR code generatedwaitForLoginsuccessfully getsbot_tokenaccount.jsongenerated with valid tokenqwen channel start my-weixin→ Connected, poll loop running normallyRelated