Skip to content

fix(連接器): 以 Fetch 攔截補上第一銀行 010103 擷取 - #114

Closed
TedLin1993 wants to merge 1 commit into
mainfrom
cursor/firstbank-010103-fetch-capture-ffc1
Closed

fix(連接器): 以 Fetch 攔截補上第一銀行 010103 擷取#114
TedLin1993 wants to merge 1 commit into
mainfrom
cursor/firstbank-010103-fetch-capture-ffc1

Conversation

@TedLin1993

Copy link
Copy Markdown
Owner

問題

PR #113 已部署到 production。手動同步仍回「交易明細讀取失敗」(HTTP 502)。Worker log 顯示新程式有跑到:

  • [firstbank] 0101-query-submit path=/NetBank/2/0101.html
  • [firstbank] 010103-timeout path=/NetBank/2/010103.html

這 10 秒內沒有 010103-cdp-response010103-http-response010103-live-frame。因此失敗原因不是「CDP 晚 2 秒才到」,而是 production Browser Rendering 根本沒有送出符合 type=Document 且 path 精確等於 /NetBank/2/010103.html 的事件,live iframe 也沒出現。

修正

  • 在 CDP Fetch.enablerequestStage: Response)攔截 010103,用 Fetch.getResponseBody 讀 body,並務必 Fetch.continueRequest
  • Network.responseReceived 不再只接受 DocumentOther / XHR / Fetch / 缺 type 也可擷取。
  • 010103 URL 比對忽略 jsessionid.htm
  • live frame 只要有「交易日期」表頭就序列化,不要求 URL 必須是精確 010103。
  • 階段 log 增加 resourceType0101-cdp-request0101-cdp-response,逾時時記錄仍存活 frame 的 path。仍不記錄帳號、金額、cookie 或 HTML body。

測試

  • 延遲 CDP、resourceType=Other、jsessionid frame、僅有 Fetch.requestPaused 的路徑。
  • npm run format:check
  • npm run typecheck
  • First Bank session tests:18 passed

請等此 PR 部署後再同步。本次未重試 production 第一銀行同步。

Open in Web Open in Cursor 

正式環境在送出 0101 後等滿 10 秒仍沒有 CDP Document 或 live frame。改在 Fetch response 階段攔截 010103、放寬資源類型與 URL 比對,並掃描所有 live frame。

Co-authored-by: Ted <TedLin1993@users.noreply.github.com>
@TedLin1993
TedLin1993 marked this pull request as ready for review August 29, 2026 06:15
@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
taiwan-fin-hub 8e77458 Aug 29 2026, 06:16 AM

@TedLin1993

Copy link
Copy Markdown
Owner Author

此 PR 的修正已完整包含於 #115;為避免重複 PR,改由 #115 直接對 main 提交。

@TedLin1993 TedLin1993 closed this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants