`secrets set` ignores `--workdir` and reads config.toml from the working directory
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- cli
调研方向
Start in apps/cli/src/commands/secrets/set/set.handler.ts, where loadCliConfig and loadCliProjectEnvironment are called with runtimeInfo.cwd. Compare with apps/cli/src/commands/config/config.load.ts, which uses cliSettings.workdir, and with runtimeInfo.cwd in apps/cli/src/shared/runtime/runtime-info.layer.ts. Done when the repro run with --workdir ../clean from leaky/ fails with SecretsNoArgumentsError and sends no request.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
supabase secrets set resolves supabase/config.toml by searching up from process.cwd(), so --workdir has no effect on which config it reads. The command merges that file's [edge_runtime.secrets] into its request body, so running it from a directory whose config declares local-only secrets pushes those values to the target project — even when --workdir points at a different, secret-free project directory.
config push, config diff and config pull do honour --workdir, which makes the behaviour of secrets set surprising.
To reproduce
mkdir -p leaky/supabase clean/supabase
cat > leaky/supabase/config.toml <<'EOF'
project_id = "leaky"
[edge_runtime.secrets]
LOCAL_ONLY = "http://127.0.0.1:54324"
EOF
printf 'project_id = "clean"\n' > clean/supabase/config.toml
cd leaky
supabase secrets set --project-ref <ref> --workdir ../clean --output-format json
No secrets are passed on the command line, so anything the command sends can only have come from a config file.
Expected behavior
--workdir ../clean is used, clean/supabase/config.toml declares no [edge_runtime.secrets], and the command fails with SecretsNoArgumentsError without sending a request.
Actual behavior
It reads leaky/supabase/config.toml and posts LOCAL_ONLY to the project:
{"_tag":"Error","error":{"code":"SecretsSetNetworkError","message":"failed to set secrets: TransportError"}}
(a request was built and attempted — here with outbound traffic blocked, to keep the test off a real project)
Running the identical command from clean/ instead gives:
{"_tag":"Error","error":{"code":"SecretsNoArgumentsError","message":"No arguments found. Use --env-file to read from a .env file."}}
So only the working directory decides which config is read.
Version
Reproduced on 2.118.0 and present in 2.122.0.
Where it comes from
apps/cli/src/commands/secrets/set/set.handler.ts calls loadCliConfig(runtimeInfo.cwd, …) and loadCliProjectEnvironment({ cwd: runtimeInfo.cwd, … }). runtimeInfo.cwd is process.cwd() in apps/cli/src/shared/runtime/runtime-info.layer.ts and never reflects --workdir. By contrast apps/cli/src/commands/config/config.load.ts loads from cliSettings.workdir and respects shouldSearchAncestors.
Why it matters
A natural way to keep local-only Edge Function secrets out of a hosted project is to keep them in one config.toml and run secrets set with --workdir pointed at another directory whose config has no secrets table. That doesn't work, and the merge is silent: nothing in the output names the secrets the config contributed, so the extra values are only visible afterwards in secrets list.
A fix could either honour --workdir here as the config commands do, or — separately useful — list the config-sourced names the command is about to send.
- 主要语言
- TypeScript
- 星标
- 2.4k
- 派生
- 537
- 平均合并
- 18 小时 2 分钟
- 30 天内合并 PR
- 387
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
supabase/cli 的其他 Issue
-
db schema declarative sync: no way to fail (non-zero exit) when the generated migration is destructive可能重新可做 关联的 PR 已关闭且未合并。 未关闭✨ Feature supabase/cli
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
Windows: Supabase CLI start fails when no Supabase containers exist可能已有人在做 @Coly010 于 1 天前认领。 未关闭🐛 Bug supabase/cli
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
-
Supabase CLI 2.122.0 prunes local Docker network before database container creation on Windows/WSL2可能已有人在做 @jgoux 于 2 天前认领。 未关闭🐛 Bug supabase/cli
难度 4/5 3-5 天 新手友好度 42/100
维护者通常 1 天内回复
-
🐛 Bug supabase/cli
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
stack: every Edge Function request starts a new worker, so the same function never reuses one and each call pays a cold start可能已有人在做 @7ttp 于 2 天前认领。 未关闭🐛 Bug supabase/cli
难度 3/5 1-2 天 新手友好度 58/100
维护者通常 1 天内回复
相似的 Issue
-
area:plugins area:security area:skills bug has repro
难度 2/5 1-3 小时 新手友好度 76/100
anthropics/claude-code#105911 ·
维护者通常 1 天内回复
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifacts未关闭
难度 2/5 1-3 小时 新手友好度 72/100
Fission-AI/OpenSpec#2165 ·
维护者通常 1 天内回复
-
🐞 bug 🧐 unconfirmed
难度 2/5 1-3 小时 新手友好度 66/100
Tencent/tdesign-vue-next#7032 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
gnosis/gnosis_vpn#661 ·
维护者通常 1 天内回复
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)未关闭triage:bug-verified
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复