AWS Serverless: .NET 6 app "No RegionEndpoint or ServiceURL configured" when calling Secrets Manager

48 Views Asked by At

I have a Visual Studio 2022 .NET 6 Serverless (SAM/Lambda) solution that utilizes the AWS Power tools on Windows 11. Both my config and credentials files in my %userprofile%\.aws folder include valid region and sso_start_url properties, i.e.:

config:

[profile xxx-xxx-xxx]
sso_start_url = https://xxxx.awsapps.com/start
sso_region = us-east-1
sso_account_id = xxxxx
sso_role_name = xxxxx
region = us-east-1
[sso-session xxxxxx]
sso_region=us-east-1
sso_start_url=https://xxxx.awsapps.com/start

credentials:

[xxx-xxx-xxx]
sso_start_url = https://xxxx.awsapps.com/start
sso_region = us-east-1
sso_account_id = xxxxx
sso_role_name = xxxxx
region = us-east-1
ignore_configured_endpoint_urls=false
toolkit_artifact_guid=2936bdec-6065-40b8-a2ab-d5020673f3ac

AWS Explorer is able to authenticate successfully, and shows all my resources:

enter image description here

And yet, I get the error No RegionEndpoint or ServiceURL configured when my app tries to call a Lambda function that calls Secrets Manager (which I am able to access successfully via the AWS Portal). The exception is thrown when it tries to instantiate AmazonSecretsManagerClient():

enter image description here

Here are the full exception details:

Amazon.Runtime.AmazonClientException
  HResult=0x80131500
  Message=No RegionEndpoint or ServiceURL configured
  Source=AWSSDK.Core
  StackTrace:
   at Amazon.Runtime.ClientConfig.Validate()
   at Amazon.Runtime.AmazonServiceClient..ctor(AWSCredentials credentials, ClientConfig config)
   at Amazon.SecretsManager.AmazonSecretsManagerClient..ctor()
   at Integrations.Documentation.Auth.POC.Lib.Secrets.SecretsHelper.<GetSecret>d__0.MoveNext() in C:\Users\xxx\xxx\xxx\xxx\xxxx\Secrets\SecretsHelper.cs:line 22

  This exception was originally thrown at this call stack:
    [External Code]
    xxx.xxx.xxx.xxx.xxx.Secrets.SecretsHelper.GetSecret(string) in SecretsHelper.cs

What am I doing wrong? Every other instance of this exception I've researched online was caused by the region or url missing from the config and/or credentials files - but my files are properly configured, as you can see above. Any suggestions?

0

There are 0 best solutions below