bcuff / elasticsearch-net-aws

Add-on to Elasticsearch.Net & NEST for using AWS's elasticsearch service.
Apache License 2.0
72 stars 27 forks source link

AWS Credentials is null #54

Closed edvanr closed 4 years ago

edvanr commented 4 years ago

Hi guys, I'm not sure if this is an issue or I'm doing something wrong here...

Basically I setup my NEST client following your instructions....

var awsOptions = _configuration.GetAWSOptions(); var httpConnection = new AwsHttpConnection(awsOptions);

The problem seems to be that the GetAWSOptions is not populating the AWSCredentials which then results in an exception...

https://github.com/bcuff/elasticsearch-net-aws/blob/master/src/Elasticsearch.Net.Aws/Elasticsearch.Net.Aws/AwsHttpConnection.cs#L39

I have checked all my AWS configuration and tested it against the AWS .net SDK just querying a S3 bucket and it seems to work without any issues. I had a look in the AWS code and it seems that the credentials do not get set until you actually request a service by calling CreateServiceClient...

var options = _configuration.GetAWSOptions(); var service = options.CreateServiceClient<IAmazonKinesisFirehose>()

Have a look here as well... https://github.com/aws/aws-sdk-net/blob/master/extensions/src/AWSSDK.Extensions.NETCore.Setup/ClientFactory.cs#L114

Let me know if you need any more information.

Thanks!

bcuff commented 4 years ago

Sorry about that. Try 7.0.4. Here's the change: https://github.com/bcuff/elasticsearch-net-aws/commit/c0f506a32d336c406c553a8a7e933d473fdb7a59

edvanr commented 4 years ago

Amazing, thanks for responding so quickly @bcuff !

bcuff commented 4 years ago

you're welcome.