[Bug] Wrangler deployment fails due to unresolved "safer-buffer" dependency in iconv-lite

Đang mở Phù hợp với người mới
#151 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@PIKACHUIM đang làm issue này rồi.

Từ ngày 1/11/2026.

  • #160 của @PIKACHUIM — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
build-system, devops

Hướng nghiên cứu

Bắt đầu bằng cách kiểm tra các khai báo phụ thuộc và cấu hình Wrangler được nhắc đến trong báo cáo triển khai, sau đó theo dõi cách iconv-lite được đưa vào trong quá trình chạy pnpm run deploy. Tái hiện lỗi bằng cách chạy pnpm install rồi đến pnpm run deploy, và kiểm tra xem có thiếu safer-buffer hay cần một alias của Wrangler không. Hoàn tất khi gói triển khai phân giải được phụ thuộc và Wrangler tiếp tục vượt qua các lỗi build đã được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Please confirm the following
  • I confirm my description is clear and polite, that I have provided the necessary diagnostic information, and that this is reproducible on the latest version.
  • I confirm I have checked the relevant documentation and existing issues / discussions, and this report is not a duplicate.
  • I confirm this is an issue with the Worker project, not caused by network or user error, and not an issue specific to the Go version.
  • I confirm I have read the open-source license / disclaimers / usage policy, and understand that I bear all risks of use.
Version (required)

82bd05d

Platform (required)

Cloudflare Workers

DB_FORMAT (required)

map (single JSON blob)

DB_DRIVER (required)

auto

Storage Driver (required)

NONE

Bug Description (required)

Steps to reproduce:

  1. Clone the OpenList-Worker repository.
  2. Install dependencies using pnpm install.
  3. Run the deployment command: pnpm run deploy.

Expected result:
The project should bundle successfully and deploy to Cloudflare Workers without errors.

Actual behavior:
The build process fails during the npx wrangler deploy step. Wrangler reports multiple errors stating it cannot resolve the safer-buffer module, which is a dependency of iconv-lite. The error message suggests adding an alias to the Wrangler configuration, but the current project config does not include this fix.

Error Information (required)

The full deploy log:

❯ pnpm run deploy
$ node scripts/deploy.js
[KV] wrangler.jsonc 已声明 KV 绑定(省略 id 字段),由 wrangler 自动创建/复用。

[构建] 正在获取官方前端构建产物 ...

$ node scripts/fetch-frontend.mjs
[fetch-frontend] Fetching official frontend build artifacts...
  Querying registry: https://registry.npmjs.org (@openlist-frontend/openlist-frontend)
  Downloading published dist: @openlist-frontend/[email protected]
  > curl -fL --retry 3 -o "/tmp/openlist-frontend-npm-WXMmDl/pkg.tgz" "https://registry.npmjs.org/@openlist-frontend/openlist-frontend/-/openlist-frontend-4.2.8.tgz"
  % Total    % Received % Xferd  Average Speed  Time    Time    Time   Current
                                 Dload  Upload  Total   Spent   Left   Speed
 74 31.41M  74 23.47M   0      0 384.7k      0   01:23   01:02   00:21 214.8k 75 31.41M  75 23.64M   0      0 381.1k      0   01:24   01:03 76 31.41M  76 23.95M   0      0 380.1k      0   01:24   01:04 77 31.41M  77 24.18M   0      0 376.6k      0   01:25   01:05 77 31.41M  77 24.34M   0      0 368.4k      0   01:27   01:07 78 31.41M  78 24.53M   0      0 365.5k      0   01:27   01:08 78 31.41M  78 24.70M   0      0 361.4k      0   01:28   01:09 79 31.41M  79 24.92M   0      0 358.9k      0   01:29   01:11 79 31.41M  79 25.05M   0      0 355.6k      0   01:30   01:12 79 31.41M  79 25.05M   0      0 350.7k      0   01:31   01:13 80 31.41M  80 25.36M   0      0 350.2k      0   01:31   01:14 81 31.41M  81 25.52M   0      0 346.4k      0   01:32   01:15 81 31.41M  81 25.68M   0      0 343.7k      0   01:33   01:16 82 31.41M  82 25.96M   0      0 338.8k      0   01:34   01:18 83 31.41M  83 26.16M   0      0 334.4k      0   01:36   01:20 83 31.41M  83 26.35M   0      0 332.0k      0   01:36   01:21 84 31.41M  84 26.39M   0      0 327.6k      0   01:38   01:22 84 31.41M  84 26.63M   0      0 326.0k      0   01:38   01:23 85 31.41M  85 26.74M   0      0 323.3k      0   01:39   01:24 85 31.41M  85 26.88M   0      0 320.9k      0   01:40   01:25 85 31.41M  85 26.99M   0      0 318.5k      0   01:40   01:26 86 31.41M  86 27.08M   0      0 314.0k      0   01:42   01:28 86 31.41M  86 27.25M   0      0 312.0k      0   01:43   01:29 87 31.41M  87 27.36M   0      0 309.3k      0   01:43   01:30 87 31.41M  87 27.52M   0      0 305.9k      0   01:45   01:32 88 31.41M  88 27.70M   0      0 303.6k      0   01:45   01:33 88 31.41M  88 27.81M   0      0 301.0k      0   01:46   01:34 89 31.41M  89 28.00M   0      0 298.6k      0   01:47   01:36 89 31.41M  89 28.14M   0      0 296.8k      0   01:48   01:37 89 31.41M  89 28.24M   0      0 294.2k      0   01:49   01:38 90 31.41M  90 28.36M   0      0 292.3k      0   01:50   01:39 90 31.41M  90 28.45M   0      0 290.0k      0   01:50   01:40 91 31.41M  91 28.62M   0      0 287.1k      0   01:52   01:42 91 31.41M  91 28.75M   0      0 285.1k      0   01:52   01:43 91 31.41M  91 28.84M   0      0 283.2k      0   01:53   01:44 92 31.41M  92 28.92M   0      0 280.9k      0   01:54   01:45 92 31.41M  92 29.04M   0      0 279.0k      0   01:55   01:46 92 31.41M  92 29.11M   0      0 276.8k      0   01:56   01:47 92 31.41M  92 29.14M   0      0 274.4k      0   01:57   01:48 93 31.41M  93 29.29M   0      0 273.2k      0   01:57   01:49 93 31.41M  93 29.39M   0      0 271.4k      0   01:58   01:50 93 31.41M  93 29.50M   0      0 269.2k      0   01:59   01:52 94 31.41M  94 29.59M   0      0 266.7k      0   02:00   01:53 94 31.41M  94 29.72M   0      0 265.1k      0   02:01   01:54 94 31.41M  94 29.81M   0      0 263.6k      0   02:01   01:55 95 31.41M  95 29.88M   0      0 261.8k      0   02:02   01:56 95 31.41M  95 30.03M   0      0 260.4k      0   02:03   01:58 95 31.41M  95 30.10M   0      0 257.5k      0   02:04   01:59 96 31.41M  96 30.23M   0      0 255.3k      0   02:05   02:01 96 31.41M  96 30.33M   0      0 253.7k      0   02:06   02:02 96 31.41M  96 30.40M   0      0 252.3k      0   02:07   02:03 97 31.41M  97 30.48M   0      0 250.6k      0   02:08   02:04 97 31.41M  97 30.55M   0      0 248.8k      0   02:09   02:05 97 31.41M  97 30.55M   0      0 246.8k      0   02:10   02:06 97 31.41M  97 30.72M   0      0 246.3k      0   02:10   02:07 97 31.41M  97 30.72M   0      0 244.3k      0   02:11   02:08 98 31.41M  98 30.89M   0      0 243.1k      0   02:12   02:10 98 31.41M  98 30.93M   0      0 241.5k      0   02:13   02:11 98 31.41M  98 31.03M   0      0 240.1k      0   02:13   02:12 99 31.41M  99 31.10M   0      0 238.4k      0   02:14   02:13 99 31.41M  99 31.21M   0      0 237.2k      0   02:15   02:14 99 31.41M  99 31.31M   0      0 235.7k      0   02:16   02:15 99 31.41M  99 31.38M   0      0 234.3k      0   02:17   02:17100 31.41M 100 31.41M   0      0 234.1k      0   02:17   02:17100 31.41M 100 31.41M   0      0 234.1k      0   02:17   02:17100 31.41M 100 31.41M   0      0 234.1k      0   02:17   02:17          78495
  > tar -xzf pkg.tgz package/dist package/package.json
  Copying frontend dist: /tmp/openlist-frontend-npm-WXMmDl/package/dist -> /home/alex/tech/OpenList-Worker/dist
  Copied static/manifest.json -> manifest.json (frontend #162)
  Stamped frontend-version 4.2.8 into dist/index.html
  Patched manifest link with crossorigin=use-credentials in dist/index.html
✓ Frontend dist ready (/home/alex/tech/OpenList-Worker/dist)

[部署] 正在部署到 Cloudflare Workers ...

$ npx wrangler deploy
npm warn Unknown project config "node-linker". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
npm warn Unknown project config "shamefully-hoist". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
npm notice run [email protected] npx
npm notice run 'wrangler' deploy
▲ [WARNING] Proxy environment variables detected. We'll use your proxy for fetch requests.



 ⛅ wrangler 4.118.0
────────────────────

✘ [ERROR] Build failed with 8 errors:

  ✘ [ERROR] Could not
  resolve "safer-buffer"
  
      node_modules/iconv-lite/encodings/dbcs-codec.js:2:21:
        2 │ var Buffer =
  require("safer-buffer").Buffer
          ╵                      ~~~~~~~~~~~~~~
  
    To fix this, you can add an entry to "alias" in your
  Wrangler configuration.
    For more guidance see:
  https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
  
  
  
  ✘ [ERROR] Could not
  resolve "safer-buffer"
  
      node_modules/iconv-lite/encodings/internal.js:2:21:
        2 │ var Buffer =
  require("safer-buffer").Buffer
          ╵                      ~~~~~~~~~~~~~~
  
    To fix this, you can add an entry to "alias" in your
  Wrangler configuration.
    For more guidance see:
  https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
  
  
  
  ✘ [ERROR] Could not
  resolve "safer-buffer"
  
      node_modules/iconv-lite/encodings/sbcs-codec.js:2:21:
        2 │ var Buffer =
  require("safer-buffer").Buffer
          ╵                      ~~~~~~~~~~~~~~
  
    To fix this, you can add an entry to "alias" in your
  Wrangler configuration.
    For more guidance see:
  https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
  
  
  
  ✘ [ERROR] Could not
  resolve "safer-buffer"
  
      node_modules/iconv-lite/encodings/utf16.js:2:21:
        2 │ var Buffer =
  require("safer-buffer").Buffer
          ╵                      ~~~~~~~~~~~~~~
  
    To fix this, you can add an entry to "alias" in your
  Wrangler configuration.
    For more guidance see:
  https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
  
  
  
  ✘ [ERROR] Could not
  resolve "safer-buffer"
  
      node_modules/iconv-lite/encodings/utf32.js:3:21:
        3 │ var Buffer =
  require("safer-buffer").Buffer
          ╵                      ~~~~~~~~~~~~~~
  
    To fix this, you can add an entry to "alias" in your
  Wrangler configuration.
    For more guidance see:
  https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
  
  
  
  ✘ [ERROR] Could not
  resolve "safer-buffer"
  
      node_modules/iconv-lite/encodings/utf7.js:2:21:
        2 │ var Buffer =
  require("safer-buffer").Buffer
          ╵                      ~~~~~~~~~~~~~~
  
    To fix this, you can add an entry to "alias" in your
  Wrangler configuration.
    For more guidance see:
  https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
  
  
  
  ✘ [ERROR] Could not
  resolve "safer-buffer"
  
      node_modules/iconv-lite/lib/index.js:3:21:
        3 │ var Buffer =
  require("safer-buffer").Buffer
          ╵                      ~~~~~~~~~~~~~~
  
    To fix this, you can add an entry to "alias" in your
  Wrangler configuration.
    For more guidance see:
  https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
  
  
  
  ✘ [ERROR] Could not
  resolve "safer-buffer"
  
      node_modules/iconv-lite/lib/streams.js:3:21:
        3 │ var Buffer =
  require("safer-buffer").Buffer
          ╵                      ~~~~~~~~~~~~~~
  
    To fix this, you can add an entry to "alias" in your
  Wrangler configuration.
    For more guidance see:
  https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
  
  
  


🪵  Logs were written to "/home/alex/.config/.wrangler/logs/wrangler-2026-10-24_13-38-43_541.log"
node:internal/errors:999
  const err = new Error(message);
              ^

Error: Command failed: npx wrangler deploy
    at genericNodeError (node:internal/errors:999:15)
    at wrappedFn (node:internal/errors:544:14)
    at checkExecSyncError (node:child_process:990:11)
    at execSync (node:child_process:1062:15)
    at run (file:///home/alex/tech/OpenList-Worker/scripts/deploy.js:58:12)
    at main (file:///home/alex/tech/OpenList-Worker/scripts/deploy.js:85:3)
    at file:///home/alex/tech/OpenList-Worker/scripts/deploy.js:98:1
    at ModuleJob.run (node:internal/modules/esm/module_job:569:25)
    at async node:internal/modules/esm/loader:650:26
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:105:5) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 316201,
  stdout: null,
  stderr: null
}

Node.js v26.12.1
[ELIFECYCLE] Command failed with exit code 1.


Relevant Configuration (required)

Note: I have not yet configured the account/project IDs, but the build fails before reaching that stage. The following wrangler.jsonc is generated by grep -v '^\s*//' wrangler.jsonc | grep -v '^\s*$'.

{
  "name": "openlist-tsworkers",
  "main": "src/backend/worker.ts",
  "compatibility_date": "2026-08-04",
  "compatibility_flags": ["nodejs_compat"],
  "workers_dev": false,
  "preview_urls": false,
  "assets": {
    "directory": "./dist",
    "binding": "ASSETS",
    "run_worker_first": ["/", "/index.html"]
  },
  "vars": {
    "ENVIRONMENT": "production",
    "DB_FORMAT": "map",
    "DB_DRIVER": "auto",
    "DB_CIPHER": "none",
    "CACHE_ENABLED": "true",
    "CACHE_DRIVER": "db",
    "CACHE_FILE_TREE": "true",
    "CACHE_DOWNLOAD_LINK": "false",
    "CACHE_TTL": "0",
    "CACHE_LINK_TTL": "5",
    "CACHE_EXCLUDE_DRIVERS": "virtual,alias,url_tree,strm,chunk",
    "SINGLEFLIGHT": "auto",
  },
}

Reproduction Link (optional)

No response

Ngôn ngữ chính
TypeScript
Star
710
Fork
1.3k
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
20

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OpenListTeam/OpenList-Worker

Tất cả issue của OpenListTeam/OpenList-Worker

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.