Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Policy fragment referenced in an API Policy from Lower Environment is not synced to Upper Environment

See original GitHub issue

Release version

APIOps Toolkit for Azure APIM Release 3.0.1

Describe the bug

When using an existing Policy Fragment in an API Policy, that association is not being synced by the time I run the Publisher Pipeline.

When running the Extractor pipeline, I am getting what is shown below:


When running the Publisher pipeline, I am getting the error below:

crit: Publisher[0] System.ArgumentException: An element with the same key but a different value already exists. Key: 'Put' at System.Collections.Immutable.ImmutableDictionary2.HashBucket.Add(TKey key, TValue value, IEqualityComparer1 keyOnlyComparer, IEqualityComparer1 valueComparer, KeyCollisionBehavior behavior, OperationResult& result) at System.Collections.Immutable.ImmutableDictionary2.AddRange(IEnumerable1 items, MutationInput origin, KeyCollisionBehavior collisionBehavior) at System.Collections.Immutable.ImmutableDictionary2.AddRange(IEnumerable1 pairs, Boolean avoidToHashMap) at System.Collections.Immutable.ImmutableDictionary2.AddRange(IEnumerable1 pairs) at System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary[TSource,TKey,TValue](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 keyComparer, IEqualityComparer1 valueComparer) at System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary[TSource,TKey,TValue](IEnumerable1 source, Func2 keySelector, Func2 elementSelector) at publisher.Publisher.GetCommitIdFiles(CommitId commitId) at publisher.Publisher.RunWithCommitId(CommitId commitId, CancellationToken cancellationToken) at publisher.Publisher.Run(CancellationToken cancellationToken) at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken) info: Microsoft.Hosting.Lifetime[0] Application is shutting down… fail: Microsoft.Extensions.Hosting.Internal.Host[9] `

Expected behavior

Extractor pipeline should extract the updated configuration and detect the existing Policy Fragment is being used in API Policy. Publisher pipeline should detect that change and sync to Upper Environment.

Actual behavior

The Extractor detects the change as shown in the image from the description. The Publisher pipelines fails in the stage “Run publisher for Dev environment”.

Reproduction Steps

  • Take an existing policy fragment name (E.G. “ForwardContext”), and associate it to a API Policy with the proper command <include-fragment fragment-id="ForwardContext" />

  • Run the Extractor and Publisher pipelines and you will receive that error.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

ddommagemoncommented, Mar 9, 2023

Hi @waelkdouh! Tested today with 4.1.0. It seems to be solved, thanks!!

waelkdouhcommented, Jan 22, 2023

Any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Policy Fragment problem in API Management - Microsoft Q&A
I want to move the part of the policy that authenticates and sets the backend service to a policy fragment. This works in...
Read more >
Reuse policy configurations in Azure API Management
Policy fragments are centrally managed, reusable XML snippets containing one or more API Management policy configurations. Policy fragments help ...
Read more >
How to Use Policy Fragments to Simplify Your Azure API ...
This retry policy fragment allows you to automatically retry API calls that return errors, while the failover policy fragment provides a way to ......
Read more >
Azure API Management Policy Fragments -
When you open the portal, you can find a new section called Policy Fragments. It works similar to named values. You can create...
Read more >
List of All Resolved Issues and New Features in R81.10 ...
ID Product Description PRJ‑45678, PRJ‑45679 CloudGuard Network PRJ‑38111, PRHF‑22608 Security Gateway In some scenarios, the Security Gateway m... PRJ‑41909, PRHF‑25737 Gaia OS Gaia WebUI logs are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found