Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG] Publisher gets 400 Putting Backends

Open
#737 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
azure, csharp
Domain
api, cloud, devops

Research direction

Start by running run-publisher-with-env.yaml and compare the extracted named-value content with the backend credentials sent through tools/code/common/Backend.cs line 415. Trace the publisher path in tools/code/publisher/Backend.cs at lines 121 and 172 to determine why the existing secret named value is rejected. Done means the pipeline publishes successfully without the 400 validation error.

Written by the indexing model from the issue text.

Description

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

Dominant language
C#
Stars
448
Forks
247
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/apiops

All issues in Azure/apiops

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.