question-mark
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.

Missing dependency AWSSDK.SecurityToken ?

See original GitHub issue

Describe the bug

Our application crashes with a runtime dependency error for AWSSDK.SecurityToken when trying to call AddSystemsManager()

Expected Behavior

No errors.

Current Behavior

When attempting to deploy this to our testing environment, our application stops working with the following error:

Unhandled exception. System.InvalidOperationException: Assembly AWSSDK.SecurityToken could not be found or loaded. This assembly must be available at runtime to use Amazon.Runtime.AssumeRoleAWSCredentials.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'AWSSDK.SecurityToken, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

File name: 'AWSSDK.SecurityToken, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly.<InternalLoad>g____PInvoke|47_0(NativeAssemblyNameParts* pAssemblyNameParts, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Int32 throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Amazon.Runtime.Internal.ServiceClientHelpers.GetSDKAssembly(String assemblyName)
…

Worth noting that it works okay on my machine™, but is only once we deploy to our k8s-based environment that this error occurs. This is not the case if I run the same docker image that is run in k8s locally - that works fine too 🤔

Reproduction Steps

This is the code I have in my application:

builder.Configuration.AddSystemsManager((options) =>
{
    options.Path = "/Prefix/For/My/Application";
    options.OnLoadException += exceptionContext =>
    {
        Console.Error.WriteLine("Error occurred while reading configuration from Parameter Store:");
    };
});

I am simply using it in the most basic manner.

Possible Solution

After installing the dependency AWSSDK.SecurityToken manually, the issue goes away. It seems like there may be a missing dependency on AWSSDK.SecurityToken in this project?

Additional Information/Context

There are other comments on here reporting similar behaviour.

AWS .NET SDK and/or Package version used

<PackageReference Include="Amazon.Extensions.Configuration.SystemsManager" Version="5.0.2" />

Targeted .NET Platform

ASP.NET 7

Operating System and version

Docker image: mcr.microsoft.com/dotnet/aspnet:7.0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
normjcommented, Jun 2, 2023

This is one of the awkward parts of the SDK where we have a circular dependency because the AWS credentials resolution and types all exist in Core but some credential profiles require AWSSDK.SecurityToken or other service clients but those service clients depend on core. This runtime dependency based approach is how we have solved the problem so far. I suspect we will need to revisit this design in the future as we try and add support for things like Native AOT which isn’t going to like this approach.

0reactions
github-actions[bot]commented, Jun 2, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade aws-sdk-net packages to version with support for ...
SecurityToken package but this means that the aws-dotnet-extensions-configuration has a dependency on it and I believe it should be adding ...
Read more >
Missing .Net 4.6.1 dependencies in .Net Core Library project.
"AWSSDK.SecurityToken": "3.1-*",. " ...
Read more >
The type 'AWSCredentials' exist in both AWSSDK.Core ...
Remove the dependency on AWSSDK and instead use AWSSDK.SecurityToken. The AWSSDK package has been replaced with a newer set of packages.
Read more >
Install AWSSDK packages with NuGet - AWS SDK for .NET
NuGet is aware of dependencies between packages and installs all required packages automatically. Warning. The list of NuGet packages might include one named ......
Read more >
Error: Could not load file or assembly 'AWSSDK' or one of ...
Could not load file or assembly 'AWSSDK' or one of its dependencies. Possible Cause. A custom module uses a different version of AWSSDK.DLL....
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found