`sentry` commands skip a `.sentryclirc` above the repository root that the docs and `createSentrySDK` read
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cli, typescript
- Lĩnh vực
- cli, developer-experience
Hướng nghiên cứu
The two readers differ: the CLI boot fills a cache in packages/cli/src/lib/dsn/project-root.ts that loadSentryCliRc in packages/cli/src/lib/sentryclirc.ts reuses, while packages/cli/src/lib/sdk-invoke.ts skips that boot. Run the attached reproducer after pnpm run bundle in packages/cli to see both forms' results. Done means both forms read the same .sentryclirc files in every step, with the reproducer exiting 0; the maintainers still have to decide whether the code or the docs change.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
sentrybundled frommainat e72bcc06cafabd9bac550b7aa3b59861e6d0a0f5 with no uncommitted changes (sentry --version:0.52.0-dev.0), and[email protected]from npm, which does the same- node v26.12.1 on win32 x64, and node v20.20.2 on linux x64 with
[email protected], which does the same
Steps to Reproduce
- Make a home folder whose
~/.sentryclircsets the org:[defaults] org=home-org - Make a folder
org/whose.sentryclircsets another org, and a repository below it,org/repo/, holding a.gitfolder:[defaults] org=above-org - In
org/repo/, runsentry release view 1.0.0withSENTRY_URLandSENTRY_AUTH_TOKENset (hereSENTRY_URLnames a local stand-in for the Sentry API), then callcreateSentrySDK({ url, token }).release.view({ orgVersion: "1.0.0" })withurlnaming the same server. - Do steps 2 and 3 again with a folder
url/whose.sentryclircsets a self-hosted server, aboveurl/repo/.git/:[defaults] url=https://sentry.example.com - Do step 3 again in
none/repo/, a repository with no.sentryclircabove it.
Expected Result
sentry commands read the .sentryclirc files the docs describe: "The CLI looks for .sentryclirc files by walking up from your current directory toward the filesystem root" (configuration.md#L9), the walk loadSentryCliRc documents (sentryclirc.ts#L316-L321) and createSentrySDK calls make. So from one folder both forms read the same files: in step 3 both name above-org, in step 4 both reach the server or both are refused, and in step 5 both take home-org from ~/.sentryclirc.
Actual Result
In step 3 the CLI takes the org from ~/.sentryclirc and the SDK takes it from org/.sentryclirc, above the repository:
# in <tmp>/org/repo, below a .sentryclirc that sets org
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
[… 17 lines: the release table …]
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/org/repo, below a .sentryclirc that sets org
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
returned release 1.0.0
exit 0; requests the stand-in received: GET /api/0/organizations/above-org/ -> 200, GET /api/0/organizations/above-org/releases/1.0.0/ -> 200
In step 4 the CLI reaches the server, and the SDK is refused by url/.sentryclirc before it sends a request:
# in <tmp>/url/repo, below a .sentryclirc that sets a self-hosted url
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
[… 17 lines: the release table …]
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/url/repo, below a .sentryclirc that sets a self-hosted url
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
Config at <tmp>\url\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:64229).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exitCode 13
exit 13; requests the stand-in received: none
In step 5 both name home-org.
The CLI reads the .sentryclirc files once, at its boot (cli.ts#L892), in the project-root walk (project-context.ts#L29). That walk stops at a repository-root marker, a VCS folder such as .git, a CI file such as .github or .gitlab-ci.yml, or an .editorconfig with root = true (dsn/project-root.ts#L589-L598, the markers at L60-L84 and L257-L307), at a DSN .env (L584-L587) or at the home folder (L610-L613), and caches what it read as loadSentryCliRc's answer for that folder, "a cache hit instead of a second walk" (L540-L557). An SDK call does not run that boot (sdk-invoke.ts#L408-L420), so its loadSentryCliRc misses the cache and walks to the filesystem root, as the docs say (sentryclirc.ts#L296-L344).
Reproducer
https://gist.github.com/YevheniiKotyrlo/28abb2a95412cd1133f7ec48e0a4401d
It runs steps 1 to 5 in a temporary folder against a local stand-in for the Sentry API that records each request. Each run starts from the caller's environment without its SENTRY_* and GIT_* variables and sets its own: HOME and USERPROFILE (the home folder of step 1), SENTRY_CONFIG_DIR (a folder of its own), TMPDIR, TEMP and TMP (a folder below the temporary folder), SENTRY_URL and SENTRY_AUTH_TOKEN for the CLI (the SDK gets url and token), and SENTRY_CLI_NO_TELEMETRY, SENTRY_CLI_NO_UPDATE_CHECK and NO_COLOR. The verdict depends on the home folder, on SENTRY_CONFIG_DIR, which keeps out a stored login that would let a self-hosted URL pass, and on SENTRY_URL and SENTRY_AUTH_TOKEN (url and token for the SDK), which send both forms to the stand-in; the rest keep telemetry, the update check, colour and what the runs leave in a temporary folder out of it. It exits 1 while the two forms read different files from org/repo or url/repo, 0 once they read the same files from both, the ones the docs describe or, should the docs change instead, the ones the CLI reads now, and 2 when a step fails, a run of step 5 does not name home-org, a run ends another way, or the run is interrupted. A .sentryclirc that sets org or url in a folder above the temporary folder would apply to the SDK's runs from every repository, so the reproducer then stops with 2; point TMPDIR (TEMP and TMP on Windows) at a folder with none above it. It needs Node 20+, and no Sentry account.
node repro.mjs # sentry@latest from npm
node repro.mjs 0.50.0 # a given version from npm
node repro.mjs <toolkit> # a getsentry/toolkit checkout: runs `pnpm run bundle` in packages/cli first
Its result on main:
RESULT (exit 1): defect shows (sentry 0.52.0-dev.0 built from e72bcc06cafa): from one folder in a repository, the CLI and the SDK read different .sentryclirc files: below a .sentryclirc that sets org, the CLI named home-org and the SDK named above-org; below a .sentryclirc that sets a self-hosted url, the CLI reached the stand-in and the SDK was refused (exit 13)
Its whole output on main
node v26.12.1 on win32 x64
$ # sentry: getsentry/toolkit at e72bcc06cafabd9bac550b7aa3b59861e6d0a0f5, no uncommitted changes
$ pnpm run bundle # in packages/cli
$ # the folders, below the temporary folder <tmp>
<tmp>/home/.sentryclirc [defaults] org=home-org (HOME and USERPROFILE)
<tmp>/none/repo/.git/
<tmp>/org/.sentryclirc [defaults] org=above-org
<tmp>/org/repo/.git/
<tmp>/url/.sentryclirc [defaults] url=https://sentry.example.com
<tmp>/url/repo/.git/
$ sentry --version
0.52.0-dev.0
# in <tmp>/none/repo, below no .sentryclirc
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/none/repo, below no .sentryclirc
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
returned release 1.0.0
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/org/repo, below a .sentryclirc that sets org
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/org/repo, below a .sentryclirc that sets org
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
returned release 1.0.0
exit 0; requests the stand-in received: GET /api/0/organizations/above-org/ -> 200, GET /api/0/organizations/above-org/releases/1.0.0/ -> 200
# in <tmp>/url/repo, below a .sentryclirc that sets a self-hosted url
$ SENTRY_URL=http://127.0.0.1:64229 SENTRY_AUTH_TOKEN=example-token sentry release view 1.0.0
Release 1.0.0
━━━━━━━━━━━━━
╭─────────────┬─────────────╮
│ Version │ 1.0.0 │
│ Status │ Unreleased │
│ Created │ Jan 1 │
│ Released │ — │
│ First Event │ — │
│ Last Event │ — │
│ Ref │ — │
│ Commits │ 0 │
│ Deploys │ 0 │
│ New Issues │ 0 │
│ Projects │ example-app │
╰─────────────┴─────────────╯
Detected from .sentryclirc (<tmp>\home\.sentryclirc)
exit 0; requests the stand-in received: GET /api/0/organizations/home-org/ -> 200, GET /api/0/organizations/home-org/releases/1.0.0/ -> 200
# in <tmp>/url/repo, below a .sentryclirc that sets a self-hosted url
> createSentrySDK({ url: "http://127.0.0.1:64229", token: "example-token" }).release.view({ orgVersion: "1.0.0" })
Config at <tmp>\url\.sentryclirc: https://sentry.example.com
Refusing to route requests here because it doesn't match the host your Sentry credentials are for (http://127.0.0.1:64229).
To use this host, run: sentry auth login --url https://sentry.example.com
To keep using your current credentials, remove this URL override.
exitCode 13
exit 13; requests the stand-in received: none
RESULT (exit 1): defect shows (sentry 0.52.0-dev.0 built from e72bcc06cafa): from one folder in a repository, the CLI and the SDK read different .sentryclirc files: below a .sentryclirc that sets org, the CLI named home-org and the SDK named above-org; below a .sentryclirc that sets a self-hosted url, the CLI reached the stand-in and the SDK was refused (exit 13)
- Ngôn ngữ chính
- TypeScript
- Star
- 975
- Fork
- 189
- Merge trung bình
- 19 giờ 57 phút
- Pull request đã merge (30 ngày)
- 542
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/toolkit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
getsentry/toolkit#2583 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
getsentry/toolkit#2531 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
mcp-feedback-pattern
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
getsentry/toolkit#2458 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
getsentry/toolkit#2444 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
mcp-feedback-pattern
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
getsentry/toolkit#2362 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của getsentry/toolkit
Issue tương tự
-
sumHorizontal, maxHorizontal, minHorizontal, allHorizontal, anyHorizontal, struct and argSortBy treat strings as literals instead of column namesCó thể đã có người làm @tomaionescu đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pola-rs/nodejs-polars#486 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
jaegertracing/jaeger-ui#4853 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/plugins platform/linux reproduced type/bug version/v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/opencode#66970 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:tui enhancement platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anthropics/claude-code#112838 ·
-
Add: Sports First TV (US)Đang mởapproved check:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày