Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG] Publisher gets 400 Putting Backends

未关闭
#737 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
32/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
azure, csharp
领域
api, cloud, devops

调研方向

首先运行 run-publisher-with-env.yaml,并将提取出的 named-value 内容与通过 tools/code/common/Backend.cs 第 415 行发送的 backend credentials 进行比较。跟踪 tools/code/publisher/Backend.cs 第 121 行和第 172 行中的 publisher 路径,以确定现有 secret named value 被拒绝的原因。完成的标准是 pipeline 在没有 400 validation error 的情况下成功发布。

由索引模型根据 Issue 内容生成。

描述

Release version

v6.0.1.4

Describe the bug

Hi,

I'm executing run-publisher-with-env.yaml pipeline and during the Run Publisher task, the Publisher is failing with the following stackstrace:

2025-03-13T09:34:17.1971177Z crit: publisher[0]
2025-03-13T09:34:17.1971989Z       Application failed.
2025-03-13T09:34:17.1973854Z       System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/***/xxxxxxxx failed with status code 400. Content is '{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"credentials","message":"Property 'func-xxx-xxxx-xxxx-xxx-xxxx-key' not found."}]}}'.
2025-03-13T09:34:17.1974692Z          at common.HttpPipelineExtensions.<>c__DisplayClass11_0.<PutContent>b__0(Response response) in /home/runner/work/apiops/apiops/tools/code/common/Http.cs:line 173
2025-03-13T09:34:17.1976368Z          at LanguageExt.Either.Left`2.Match[B](Func`2 Left, Func`2 Right)
2025-03-13T09:34:17.1976942Z          at common.HttpPipelineExtensions.PutContent(HttpPipeline pipeline, Uri uri, BinaryData content, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Http.cs:line 173
2025-03-13T09:34:17.1977363Z          at common.BackendModule.PutDto(BackendUri uri, BackendDto dto, HttpPipeline pipeline, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Backend.cs:line 415
2025-03-13T09:34:17.1977834Z          at publisher.BackendModule.<>c__DisplayClass11_0.<<GetPutBackendInApim>b__0>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/Backend.cs:line 172
2025-03-13T09:34:17.1978134Z       --- End of stack trace from previous location ---
2025-03-13T09:34:17.1978421Z          at publisher.BackendModule.<>c__DisplayClass7_1.<<GetPutBackend>b__1>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/Backend.cs:line 121
2025-03-13T09:34:17.1978701Z       --- End of stack trace from previous location ---
2025-03-13T09:34:17.1979001Z          at common.OptionExtensions.IterTask[T](Option`1 option, Func`3 action, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Option.cs:line 22
2025-03-13T09:34:17.1979360Z          at common.OptionExtensions.IterTask[T](Option`1 option, Func`2 action) in /home/runner/work/apiops/apiops/tools/code/common/Option.cs:line 16
2025-03-13T09:34:17.1979833Z          at publisher.BackendModule.<>c__DisplayClass7_0.<<GetPutBackend>b__0>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/Backend.cs:line 121
2025-03-13T09:34:17.1980115Z       --- End of stack trace from previous location ---
2025-03-13T09:34:17.1980345Z          at System.Threading.Tasks.Parallel.<>c__53`1.<<ForEachAsync>b__53_0>d.MoveNext()
2025-03-13T09:34:17.1980576Z       --- End of stack trace from previous location ---
2025-03-13T09:34:17.1980910Z          at common.IEnumerableExtensions.IterParallel[T](IEnumerable`1 enumerable, Func`3 action, Int32 maxDegreeOfParallelism, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Enumerable.cs:line 61
2025-03-13T09:34:17.1981383Z          at common.IEnumerableExtensions.IterParallel[T](IEnumerable`1 enumerable, Func`3 action, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Enumerable.cs:line 47
2025-03-13T09:34:17.1981768Z          at publisher.BackendModule.<>c__DisplayClass1_0.<<GetPutBackends>b__0>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/Backend.cs:line 54
2025-03-13T09:34:17.1982053Z       --- End of stack trace from previous location ---
2025-03-13T09:34:17.1982334Z          at publisher.AppModule.<>c__DisplayClass1_0.<<GetRunApplication>b__0>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/App.cs:line 169
2025-03-13T09:34:17.1982649Z       --- End of stack trace from previous location ---
2025-03-13T09:34:17.1982925Z          at common.HostingModule.RunApplication(IHost host) in /home/runner/work/apiops/apiops/tools/code/common/Hosting.cs:line 89
2025-03-13T09:34:17.1983175Z info: Microsoft.Hosting.Lifetime[0]
2025-03-13T09:34:17.1983362Z       Application is shutting down...
2025-03-13T09:34:17.2061880Z Unhandled exception. System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/***/xxxxxxxx failed with status code 400. Content is '{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"credentials","message":"Property 'func-xxx-xxxx-xxxx-xxx-xxxx-key' not found."}]}}'.
2025-03-13T09:34:17.2062697Z    at common.HttpPipelineExtensions.<>c__DisplayClass11_0.<PutContent>b__0(Response response) in /home/runner/work/apiops/apiops/tools/code/common/Http.cs:line 173
2025-03-13T09:34:17.2063210Z    at LanguageExt.Either.Left`2.Match[B](Func`2 Left, Func`2 Right)
2025-03-13T09:34:17.2063544Z    at common.HttpPipelineExtensions.PutContent(HttpPipeline pipeline, Uri uri, BinaryData content, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Http.cs:line 173
2025-03-13T09:34:17.2064074Z    at common.BackendModule.PutDto(BackendUri uri, BackendDto dto, HttpPipeline pipeline, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Backend.cs:line 415
2025-03-13T09:34:17.2064557Z    at publisher.BackendModule.<>c__DisplayClass11_0.<<GetPutBackendInApim>b__0>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/Backend.cs:line 172
2025-03-13T09:34:17.2064847Z --- End of stack trace from previous location ---
2025-03-13T09:34:17.2065149Z    at publisher.BackendModule.<>c__DisplayClass7_1.<<GetPutBackend>b__1>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/Backend.cs:line 121
2025-03-13T09:34:17.2065434Z --- End of stack trace from previous location ---
2025-03-13T09:34:17.2065734Z    at common.OptionExtensions.IterTask[T](Option`1 option, Func`3 action, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Option.cs:line 22
2025-03-13T09:34:17.2066094Z    at common.OptionExtensions.IterTask[T](Option`1 option, Func`2 action) in /home/runner/work/apiops/apiops/tools/code/common/Option.cs:line 16
2025-03-13T09:34:17.2066443Z    at publisher.BackendModule.<>c__DisplayClass7_0.<<GetPutBackend>b__0>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/Backend.cs:line 121
2025-03-13T09:34:17.2066740Z --- End of stack trace from previous location ---
2025-03-13T09:34:17.2066971Z    at System.Threading.Tasks.Parallel.<>c__53`1.<<ForEachAsync>b__53_0>d.MoveNext()
2025-03-13T09:34:17.2067204Z --- End of stack trace from previous location ---
2025-03-13T09:34:17.2067541Z    at common.IEnumerableExtensions.IterParallel[T](IEnumerable`1 enumerable, Func`3 action, Int32 maxDegreeOfParallelism, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Enumerable.cs:line 61
2025-03-13T09:34:17.2067984Z    at common.IEnumerableExtensions.IterParallel[T](IEnumerable`1 enumerable, Func`3 action, CancellationToken cancellationToken) in /home/runner/work/apiops/apiops/tools/code/common/Enumerable.cs:line 47
2025-03-13T09:34:17.2068382Z    at publisher.BackendModule.<>c__DisplayClass1_0.<<GetPutBackends>b__0>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/Backend.cs:line 54
2025-03-13T09:34:17.2068664Z --- End of stack trace from previous location ---
2025-03-13T09:34:17.2069076Z    at publisher.AppModule.<>c__DisplayClass1_0.<<GetRunApplication>b__0>d.MoveNext() in /home/runner/work/apiops/apiops/tools/code/publisher/App.cs:line 169
2025-03-13T09:34:17.2069355Z --- End of stack trace from previous location ---
2025-03-13T09:34:17.2069614Z    at common.HostingModule.RunApplication(IHost host) in /home/runner/work/apiops/apiops/tools/code/common/Hosting.cs:line 89
2025-03-13T09:34:17.2070055Z    at common.HostingModule.RunHost(String[] arguments, String applicationName, Action`1 configureRunApplication) in /home/runner/work/apiops/apiops/tools/code/common/Hosting.cs:line 24
2025-03-13T09:34:17.2070418Z    at publisher.Program.Main(String[] arguments) in /home/runner/work/apiops/apiops/tools/code/publisher/Program.cs:line 10
2025-03-13T09:34:17.2070676Z    at publisher.Program.<Main>(String[] arguments)

I have checked the named values folder of the extracted files and I can find the folder with the same name the log is saying don't find it and the content is similar to this one:

{
  "properties": {
    "displayName": "func-xxx-xxxx-xxxx-xxx-xxxx-key",
    "secret": true,
    "tags": [
      "key",
      "function",
      "auto"
    ]
  }
}

And of course I can find that name value on the original APi Management.

Our Azure Functions are being imported in API Management using the wizard, that's why there is a tag "auto"

I'm wondering if this is happening due to the way we are importing our Azure Functions on API Management or because the named values are secrets.

Expected behavior

Expected successful publishing

Actual behavior

{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"credentials","message":"Property 'func-xxx-xxxx-xxxx-xxx-xxxx-key' not found."}]}}

Reproduction Steps

Execute run-publisher-with-env.yaml

主要语言
C#
星标
448
派生
247
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/apiops 的其他 Issue

查看 Azure/apiops 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。