I am developing an app with UNITY 2017.2.3f1 and the aws-sdk-unity_3.3.396.2
S3 works fine which means that many elements are OK. The code works fine for MAC and Android
However when I try to post an element on DynamoDB with the following code
var rec = new Document();
rec["id"] = 1;//recName;
rec["Lat"] = 2;//Input.location.lastData.latitude;
rec["Long"] = 3;//Input.location.lastData.longitude;
rec["Time"] = 4;//recTime;
table.PutItemAsync(rec, (r) => {
Debug.Log("\n rec has been poted " + r.Exception + " *222444*****************");
textnotification.text = "Archivo subido con éxito";
Invoke("cleanText", 3);
butSender.interactable = false;
butPlayer.interactable = true;
butRecorder.interactable = true;
hasnotbeensent = false;
});
it complains with the following error.
System.InvalidOperationException: No converter configured for type System.String
at Amazon.DynamoDBv2.ConverterCache.GetConverter (System.Type type) [0x00000] in <filename unknown>:0
at Amazon.DynamoDBv2.DynamoDBEntryConversion.ConvertToEntry (System.Type inputType, System.Object value) [0x00000] in <filename unknown>:0
at Amazon.DynamoDBv2.DocumentModel.UnconvertedDynamoDBEntry.ConvertToAttributeValue (Amazon.DynamoDBv2.DocumentModel.AttributeConversionConfig conversionConfig) [0x00000] in <filename unknown>:0
at Amazon.DynamoDBv2.DocumentModel.Document.ToAttributeMap (Amazon.DynamoDBv2.DynamoDBEntryConversion conversion, IEnumerable1 epochAttributes) [0x00000] in <filename unknown>:0
at Amazon.DynamoDBv2.DocumentModel.Table.PutItemHelper (Amazon.DynamoDBv2.DocumentModel.Document doc, Amazon.DynamoDBv2.DocumentModel.PutItemOperationConfig config) [0x00000] in <filename unknown>:0
at Amazon.DynamoDBv2.DynamoDBAsyncExecutor+<>c__DisplayClass1_0
1[T].<ExecuteAsync>b__0 (System.Object state) [0x00000] in <filename unknown>:0 * *
I think it is a Bug but I am not sure.
Hi all, I have one question and I can't find answer for it (SO, google, numerous tries my own code). How can I instantiate AmazonCognitoIdentityProviderClient?
I'm using .net core 2 and the code is really simple:
var credentials = new EnvironmentVariablesAWSCredentials();
CognitoProvider = new AmazonCognitoIdentityProviderClient(credentials, RegionEndpoint.EUCentral1);
But AmazonCognitoIdentityProviderClient throws exceptionSystem.IO.FileNotFoundException: 'Could not find file 'C:\Users\USER\.aws\credentials'.'
I know what it means, but why is it throwing that exception? I want to use environment credentials and they are all right (EnvironmentVariablesAWSCredentials doesnt complain and Environment.GetEnvironmentVariable on AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY returns correct values).
I can provide the file on my local environment but I can't do that on production. How am I suppose to pass credentials to cognito client? Am I missing something?
"AWS": {
"Region": ...,
"AccessKeyId": ...,
"SecretAccessKey":...
},
but I cannot create a s3 client
opConfig.QueryFilter =
new List<ScanCondition>
{
new ScanCondition("Status", ScanOperator.Equal, 10),
new ScanCondition("Status", ScanOperator.Equal, 4),
new ScanCondition("PlanType", ScanOperator.Equal, "SML"),
//new ScanCondition("NormalRoadConditions", ScanOperator.Equal, true)
};
List<string> partionKeys = new List<string>() { "52049E96-14FA-4960-B3CE-F7400C4AC6CD", "01F3DF08-4D0F-4E92-BBE3-8E46BA77E73B", "52117BC1-7256-4C36-868E-465DB2178286" };
if (!string.IsNullOrEmpty(TableName))
{
AWSConfigsDynamoDB.Context.TypeMappings[typeof(Plan)] = new Amazon.Util.TypeMapping(typeof(Plan), TableName);
}
var start = DateTime.Now;
int totalCount = 0;
var config = new DynamoDBContextConfig { Conversion = DynamoDBEntryConversion.V2 };
var client = new AmazonDynamoDBClient(new StoredProfileAWSCredentials("sandbox"), RegionEndpoint.EUWest1);
DbContext = new DynamoDBContext(client, config);
var opConfig = new DynamoDBOperationConfig { IndexName = "OrganizationId-Created-index" };
opConfig.QueryFilter =
new List<ScanCondition>
{
new ScanCondition("Status", ScanOperator.Equal, 10),
new ScanCondition("Status", ScanOperator.Equal, 4),
new ScanCondition("PlanType", ScanOperator.Equal, "SML"),
//new ScanCondition("NormalRoadConditions", ScanOperator.Equal, true)
};
foreach (var partionKey in partionKeys)
{
var result = Program.DbContext.QueryAsync<Plan>(partionKey.ToLower(), opConfig);
while (!result.IsDone)
{
var plans = result.GetNextSetAsync().Result;
totalCount += plans.Count;
}
}
public async Task<string> FunctionHandler(S3Event evnt, ILambdaContext context)
{
var serviceCollection = new ServiceCollection();
ConfigureServices(serviceCollection);
// service provider
var serviceProvider = serviceCollection.BuildServiceProvider();
// entry to run app
var service = serviceProvider.GetService<ApplicationService>();
return await service.LocalFunctionHandler(evnt, context);
}
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<Logger>();
services.AddSingleton<IAmazonS3>(s3 => new AmazonS3Client(Amazon.RegionEndpoint.USEast1));
services.AddSingleton<IAmazonBatch>(batch => new AmazonBatchClient(Amazon.RegionEndpoint.USEast1));
services.AddTransient<ApplicationService>();
}
var token = await HttpContext.GetTokenAsync("access_token").ConfigureAwait(false);
var token1 = await HttpContext.GetTokenAsync("id_token").ConfigureAwait(false);
var accesToken = Request.Headers["Authorization"];
var refreshToken = await HttpContext.GetTokenAsync("refresh_token").ConfigureAwait(false);
AuthFlowResponse authResponse = await user.StartWithSrpAuthAsync(new InitiateSrpAuthRequest { Password = inPassword });
string idToken = authResponse.AuthenticationResult.IdToken;
@klaytaybai VersionId with whitespace is only our problem, I understand it.
The common problem is that this code crashes too:
var client = new AmazonS3Client(bucketRegion);
var request = new PutObjectRequest
{
Key = "test ",
BucketName = "bucket",
ContentBody = "test"
};
using (var response = await client.PutObjectAsync(request))
{
}
with SignatureDoesNotMatch.
http://blablabla/?key=test
, but signhttp://blablabla/?key=test%20
I'm receiving S3 errors when running a project in Visual Studio 2019, but which works just fine in VS 2017. The error happens when instantiating an AmazonS3Client :
AmazonS3Client s3Client = new AmazonS3Client(RegionEndpoint.USEast1);
and getting the error:
System.ArgumentException
HResult=0x80070057
Message=An item with the same key has already been added. Key: System.Collections.Generic.Dictionary
2[System.String,System.Collections.Generic.Dictionary2[System.String,System.Object]]
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException[T](T key)