channel-worker 2.5.68 → 2.5.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "2.5.68",
3
+ "version": "2.5.69",
4
4
  "description": "Channel Manager worker daemon — runs on remote machines to execute video pipeline jobs",
5
5
  "main": "lib/daemon.js",
6
6
  "bin": {
@@ -434,7 +434,7 @@ async function cdpSetInputFiles(page, inputHandle, filePath, log, tag) {
434
434
  });
435
435
  if (!nodeId) throw new Error('CDP querySelector: tagged input not found');
436
436
  await cdp.send('DOM.setFileInputFiles', { files: [filePath], nodeId });
437
- log('info', `[${tag}] file set via CDP DOM.setFileInputFiles (>50MB bypass)`);
437
+ log('info', `[${tag}] file set via CDP DOM.setFileInputFiles (đường truyền path, mọi dung lượng)`);
438
438
  } finally {
439
439
  await inputHandle.evaluate((el, a) => el.removeAttribute(a), ATTR).catch(() => {});
440
440
  if (cdp) await cdp.detach().catch(() => {});
@@ -446,12 +446,24 @@ async function cdpSetInputFiles(page, inputHandle, filePath, log, tag) {
446
446
  // falls back to the CDP command only on the size error.
447
447
  async function setVideoFile(page, inputHandle, filePath, log, tag = 'fb-pw') {
448
448
  if (!inputHandle) throw new Error('setVideoFile: no input handle');
449
+ // VÙNG CHẾT 20-50MB (đo thật 01/09): native setInputFiles đẩy TOÀN BỘ byte
450
+ // qua CDP dưới dạng base64, nên file vừa đủ lớn là quá 30s mặc định của
451
+ // Playwright và ném TimeoutError — trong khi >50MB lại ném đúng chữ "larger
452
+ // than 50MB" nên được rơi về CDP và chạy ngon. Kết quả: video 44,1MB fail,
453
+ // còn 163MB cùng kênh đăng bình thường.
454
+ //
455
+ // DOM.setFileInputFiles truyền ĐƯỜNG DẪN chứ không đẩy byte, nên hợp mọi
456
+ // dung lượng. Vì vậy: native chỉ được thử nhanh (12s) như đường tắt, hỏng vì
457
+ // BẤT KỲ lý do gì cũng rơi về CDP — không lọc theo thông điệp lỗi nữa, chính
458
+ // cái lọc đó là thứ giấu mất đường cứu.
459
+ // Vì browser nối qua CDP nên Playwright coi nó là "remote" và đẩy file dưới
460
+ // dạng base64 — 44MB thành ~59MB trên dây, quá 30s mặc định. Cho hẳn 150s:
461
+ // native là đường ĐÃ CHẠY ĐƯỢC 829 lượt, chỉ thiếu giờ chứ không hỏng.
449
462
  try {
450
- await inputHandle.setInputFiles(filePath); // native works for <50MB
463
+ await inputHandle.setInputFiles(filePath, { timeout: 150000 });
451
464
  return;
452
465
  } catch (e) {
453
- if (!/larger than 50\s?mb|not connected to the server/i.test(String(e.message || ''))) throw e;
454
- log('info', `[${tag}] native setInputFiles hit the 50MB CDP cap — switching to DOM.setFileInputFiles…`);
466
+ log('info', `[${tag}] native setInputFiles không xong (${String(e.message || '').slice(0, 70)}) chuyển sang DOM.setFileInputFiles…`);
455
467
  }
456
468
  await cdpSetInputFiles(page, inputHandle, filePath, log, tag);
457
469
  }
@@ -2797,5 +2809,6 @@ module.exports.__testables = {
2797
2809
  REEL_CREATE_SELECTORS,
2798
2810
  REEL_ENTRY_SELECTORS,
2799
2811
  ADD_VIDEO_SELECTORS,
2812
+ setVideoFile,
2800
2813
  FB_REEL_CREATE_URL,
2801
2814
  };