Missing dependency AWSSDK.SecurityToken ?
See original GitHub issueDescribe 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:
- Created 5 months ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
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.⚠️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.