Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Publisher returns 400 on namedValue validation error #722

Closed
anotherRedbeard opened this issue Jan 17, 2025 · 2 comments
Closed

[BUG] Publisher returns 400 on namedValue validation error #722

anotherRedbeard opened this issue Jan 17, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@anotherRedbeard
Copy link
Contributor

Release version

v6.0.1.3

Describe the bug

User has four named values, and one of them is causing the run to fail due to a 400.

Error:

2025-01-15T21:11:21.9043254Z info: publisher[0]
2025-01-15T21:11:21.9043509Z Putting named value "nameValueName"...
2025-01-15T21:11:21.9048080Z trce: HttpPipeline[0]
2025-01-15T21:11:21.9048306Z Starting request
2025-01-15T21:11:21.9048533Z Method: PUT
2025-01-15T21:11:21.9048935Z Uri: https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/namedValues/***?api-version=2023-09-01-preview
2025-01-15T21:11:21.9056031Z Content: {"properties":{"displayName":"name","secret":false,"tags":[],"value":"value"}}

2025-01-15T21:11:22.3571445Z trce: HttpPipeline[0]
2025-01-15T21:11:22.3571973Z Received response
2025-01-15T21:11:22.3572636Z Method: PUT
2025-01-15T21:11:22.3573114Z Uri: https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/namedValues/***?api-version=2023-09-01-preview
2025-01-15T21:11:22.3573517Z Status code: 201
2025-01-15T21:11:22.3573796Z Duration (hh:mm:ss): 00:00:00.4521093
2025-01-15T21:11:22.3574034Z Content: {
2025-01-15T21:11:22.3574411Z "id": "/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.ApiManagement/service/serviceName/namedValues/nameValueName",
2025-01-15T21:11:22.3574795Z "type": "Microsoft.ApiManagement/service/namedValues",
2025-01-15T21:11:22.3575050Z "name": "name",
2025-01-15T21:11:22.3575262Z "properties": {
2025-01-15T21:11:22.3575502Z "ProvisioningState": "InProgress"
2025-01-15T21:11:22.3575713Z }
2025-01-15T21:11:22.3575896Z }

2025-01-15T21:11:23.6351174Z trce: HttpPipeline[0]
2025-01-15T21:11:23.6352000Z Received response
2025-01-15T21:11:23.6352266Z Method: GET
2025-01-15T21:11:23.6352717Z Uri: https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/namedValues/***?api-version=2023-09-01-preview&asyncId=***&asyncCode=201
2025-01-15T21:11:23.6353178Z Status code: 400
2025-01-15T21:11:23.6353465Z Duration (hh:mm:ss): 00:00:00.2792674
2025-01-15T21:11:23.6353857Z Content: {"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"name","message":"Property with the same name already exist."}]}}
2025-01-15T21:11:23.6547293Z crit: publisher[0]
2025-01-15T21:11:23.6547857Z Application failed.

When the user executes the PUT using the management APIs they work as expected outside of the pipeline. We've also confirmed that there is not another property with the same name using this endpoint: GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues?api-version=2024-05-01

Expected behavior

Named value is updated with the values from the json body

Actual behavior

Update doesn't occur b/c the GET fails after the PUT and causes the Publisher to shut down

Reproduction Steps

  • Make a change to a NamedValue
  • Run the extractor pipeline
  • Approve the PR that was created from extractor pipeline
Copy link

  Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
  Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.

@waelkdouh waelkdouh added the bug Something isn't working label Jan 17, 2025
@anotherRedbeard
Copy link
Contributor Author

anotherRedbeard commented Jan 17, 2025

I'll be closing this issue, as I found the problem. I didn't realize before, but my folder name and my display name were slightly different. The publisher thought it needed to create a new Named Value instead of update it which failed because there was already one out there. Here was my example:

existing Values
foldername: /namedValues/new-valued
displayname: new-value

new Values
foldername: /namedValues/new-value
displayname: new-value

The fix was to remove the named value from APIM and re-run the pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants