SwiftPM artifact setup gives up on the first dropped connection to a version lookup

未關閉 適合新手
#59,942 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, node.js, react-native

研究方向

從 packages/react-native/scripts/spm/download-spm-artifacts.js 開始,特別查看 resolveNightlyVersion、resolveLatestV1Version 和 resolveSnapshotUrl;將它們各自單次呼叫 fetch 的行為與 download() 中的重試行為進行比較。執行提供的重現程式,確認每次版本或中繼資料查詢在連線中斷後都會重試,接著驗證設定流程會繼續下載成品。

由索引模型根據 Issue 內容生成。

描述

Description

#59214 made download() in packages/react-native/scripts/spm/download-spm-artifacts.js retry transport errors and HTTP 408, 429 and 5xx. The lookups that run before the downloads still call fetch once: resolveNightlyVersion (registry.npmjs.org/<package>/nightly), resolveLatestV1Version (registry.npmjs.org/hermes-compiler/latest-v1) and resolveSnapshotUrl (each maven-metadata.xml). A dropped connection to any of them ends the SwiftPM setup with fetch failed, and the CI lane with it:

  • test_ios_spm_helloworld / test (Debug), run 38960453730 on #59149: Fetching snapshot metadata: https://central.sonatype.com/repository/maven-snapshots/com/facebook/hermes/hermes-ios/260318099.0.4-SNAPSHOT/maven-metadata.xml, then hermes-engine: fetch failed.
  • test_ios_rntester (Release), run 43036111930 on #59073, after #59214: Resolving nightly version from npm: react-native, then [setup-apple-spm] Artifact setup failed: fetch failed.
Steps to reproduce
  1. Clone the reproducer. It is the reproducer template with react-native and every @react-native/* package at 0.90.0-nightly-20261111-1273ca128 and @react-native-community/cli at 21.0.0-alpha.1, as the current community template sets up the nightly, plus drop-first-lookup.mjs, a node --import preload that fails the first request to each lookup with the TypeError: fetch failed a reset connection gives and answers each xcframework download with 404, and repro.sh.
  2. Run bash repro.sh. It installs the app and runs node_modules/react-native/scripts/spm/download-spm-artifacts.js --version nightly --flavor debug under the preload.
  3. Expected: the setup sends the lookup again, as download() does, and goes on to the downloads. Seen: it exits 1 after one attempt.
node v26.12.1, MINGW64_NT-10.0-26300 x86_64, react-native 0.90.0-nightly-20261111-1273ca128
[download-spm-artifacts]   Resolving nightly version from npm: react-native
[drop-first-lookup] attempt 1: https://registry.npmjs.org/react-native/nightly
fetch failed
download-spm-artifacts.js exited 1
RESULT: the setup exited 1 with "fetch failed" after one dropped connection to: https://registry.npmjs.org/react-native/nightly
React Native Version

0.90.0-nightly-20261111-1273ca128

Affected Platforms

Build - MacOS, Build - Windows

Output of npx @react-native-community/cli info
System:
  OS: Windows 11 10.0.26300
  CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor          "
  Memory: 110.43 GB / 255.67 GB
Binaries:
  Node:
    version: 26.12.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Users\yevhe.YEVHENII\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 12.2.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    Versions:
      - 10.0.19041.0
      - 10.0.26100.0
IDEs:
  Android Studio: AI-262.9437.185.2621.16467767
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.20.1
    path: C:\Program Files\Microsoft\jdk-17.0.20.101-hotspot\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 21.0.0-alpha.1
    wanted: 21.0.0-alpha.1
  react:
    installed: 19.3.0
    wanted: 19.3.0
  react-native:
    installed: 0.90.0-nightly-20261111-1273ca128
    wanted: 0.90.0-nightly-20261111-1273ca128
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs
node v26.12.1, MINGW64_NT-10.0-26300 x86_64, react-native 0.90.0-nightly-20261111-1273ca128
[download-spm-artifacts]   Resolving nightly version from npm: react-native
[drop-first-lookup] attempt 1: https://registry.npmjs.org/react-native/nightly
fetch failed
download-spm-artifacts.js exited 1
RESULT: the setup exited 1 with "fetch failed" after one dropped connection to: https://registry.npmjs.org/react-native/nightly
MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/rn-spm-lookup-not-retried

Screenshots and Videos

None: the setup's output above is the whole of it.

主要語言
C++
星號
127k
分支
25.5k
平均合併
3 天 18 小時
30 天內合併 PR
188

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

react/react-native 的其他 Issue

查看 react/react-native 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。