opencode update/upgrade times out behind corporate npm mirror: installer hard-codes registry.npmjs.org and ignores configured registry

Abierto Apto para principiantes
#62,403 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
bash, typescript
Área
cli, devops

Línea de trabajo

Lee el instalador curl en install, especialmente las URL del registro en las líneas 195, 199 y 212, y comprueba cómo recibe la configuración de npm. Reproduce el problema con un mirror del registro configurado y confirma que el instalador lo usa tanto para las comprobaciones de disponibilidad como para las descargas de tarballs. El trabajo estará terminado cuando la ruta de actualización pueda usar el registro configurado y siga recurriendo a npmjs cuando no haya ninguno configurado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

pending close triaging
Description

opencode update (and the opencode upgrade step it shells out to) times out on networks where registry.npmjs.org is unreachable, even though the machine has a fully working corporate npm mirror (JFrog Artifactory) configured in ~/.npmrc.

Root cause: the curl installer script hard-codes https://registry.npmjs.org in three places, ignoring the configured npm registry:

  • install line 195 — version availability check: https://registry.npmjs.org/$package_scope%2fcli-$target/$specific_version
  • install line 199 — legacy package name fallback, same hard-coded host
  • install line 212 — tarball download: url="https://registry.npmjs.org/$package_name/-/$filename"

On my network registry.npmjs.org connections hang until timeout (the corporate egress proxy never completes the TLS handshake to that host), so both the availability check and the tarball download fail. opencode update reports only "Timed out" with no indication of which URL/host failed, and no way to point it at the internal mirror.

Evidence from this network:

$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://registry.npmjs.org/@opencode%2fcli-linux-x64/2.2.5
 HTTP 000 / connection hangs (killed after 15 s)

$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://api.github.com/  # control
 HTTP 200 0.55 s

The internal mirror serves the exact same package and tarball (same path shape, same checksums):

$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" \
    https://<internal-artifactory>/api/npm/npm-group-all/@opencode%2fcli-linux-x64/2.2.5
 HTTP 200 2.2 s

Workaround I used: download the GitHub release tarball manually and install it with install --binary, which correctly skips the npm download path.

This is the installer-side instance of the registry problem tracked in #57797 (which covers the Desktop SSH bootstrap). Suggested fix, same as proposed there: respect NPM_CONFIG_REGISTRY / npm_config_registry (and ideally ~/.npmrc registry=) with fallback to https://registry.npmjs.org:

registry="${NPM_CONFIG_REGISTRY:-${npm_config_registry:-https://registry.npmjs.org/}}"
registry="${registry%/}"

then use $registry in place of the three hard-coded URLs. Additionally, failing fast with a clear error naming the unreachable host (instead of a generic "Timed out") would make this class of problem diagnosable.

Steps to reproduce
  1. Be on a network where registry.npmjs.org is unreachable (direct or via corporate egress proxy that cannot reach it), with a working npm mirror set in ~/.npmrc.
  2. Run opencode update with any version prior to the target.
  3. The opencode upgrade --method curl step shells out to the install script, which hangs on registry.npmjs.org and is killed by the updater's timeout.
┌  Upgrade
│ ●  Using method: curl
│ ●  From 2.0.18 → 2.2.5
│ ■  Upgrade failed
│ ■  The OpenCode installer failed
│ │  Timed out
│ │  Command  opencode upgrade 2.2.5 --method curl
└  Failed
OpenCode version

2.0.18 → 2.2.5 (upgrade attempt); affected installer script served at https://opencode.ai/v2/install

Operating System

RHEL 8 x86_64 (linux-x64)

Terminal

bash

Lenguaje dominante
TypeScript
Estrellas
224k
Forks
30k
Merge medio
4 h 44 min
PR fusionados (30 d)
513

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anomalyco/opencode

Todos los issues de anomalyco/opencode

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.