[BUG] Publisher gets 400 from Azure

Open
#719 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
azure, csharp
Domain
api, cloud

Research direction

Start by reproducing the named-value flow: extract the configuration, then publish the extracted configuration with v6. Compare the PUT request content against the issue's working manual request, and consider the issue done when Azure accepts the request and publishing completes successfully.

Written by the indexing model from the issue text.

Description

Release version

v6.0.1.3

Describe the bug

I already have configuration of APIM in my GitHub repo collected by v5 of ApiOps. I extract everything successfully using v6.0.1.3. It created a few not essential changes related to a version (e.g. changed order of parameters in json). So almost the same configuration was published by v5 of ApiOps successfully. When I run publisher v6 it can't complete PUT operation. As you can see in log below publisher excludes "displayName" property from "Content". I tried to run the same API request manually and it actually does not work. It works only if we have "displayName" property in Content of request.

This is description of named value:
{
"properties": {
"displayName": "TestNamedValue",
"secret": false,
"tags": [],
"value": "some_value"
}
}

This is log:
Starting request
Method: PUT
Uri: https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/namedValues/TestNamedValue?api-version=2023-09-01-preview
Content: {"properties":{"secret":false,"tags":[],"value":"some_value"}}
trce: HttpPipeline[0]
Received response
Method: PUT
Uri: https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/namedValues/TestNamedValue?api-version=2023-09-01-preview
Status code: 400
Duration (hh:mm:ss): 00:00:00.5015046
Content: {"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"name","message":"NamedValue (display name) should be between 1 and 256 characters long."}]}}
crit: publisher[0]
Application failed.
System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/namedValues/TestNamedValue?api-version=2023-09-01-preview failed with status code 400. Content is '{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"name","message":"NamedValue (display name) should be between 1 and 256 characters long."}]}}'.

Expected behavior

Expected successful publishing

Actual behavior

'{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"name","message":"NamedValue (display name) should be between 1 and 256 characters long."}]}}'.

Reproduction Steps

Extract configuration of Named Values.
Publish extracted configuration.

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.