BatchGet, BatchWrite,QueryAll gives following error on IOS using Unity 5.3.6.
It works perfectly with unity 5.3.5
Supplied AttributeValue has more than one datatypes set, must contain exactly one of the supported datatypes
What does this error means?
Typically, this means that the server is receiving an AttributeValue with multiple fields set (such as N and S), which is not supported.
Can you post the code that reproduces this issue?
It is working perfectly using unity 5.3.5. If I use Unity 5.3.6, it works perfectly in Android but fails everytime on IOS. Following is the QueryAll usage. To reproduce, you can try existing sample with Unity 5.3.6 on ios.
// search all, SDK will iterate through all. do not have super heavy query
private void SearchAll<T>(AmazonDynamoDBResult<AsyncSearch<T>> searchResult, Action<List<T>> onGet=null) {
if (searchResult.Exception != null) {
MogLog.Error("SearchAll Error [" + typeof(T) + "]: " + searchResult.Exception.Message + " , " + ((searchResult.Exception.InnerException != null) ? searchResult.Exception.InnerException.Message : ""));
if (onGet != null) {
onGet(null);
return;
}
}
AsyncSearch<T> search = searchResult.Result;
// Debug.Log ("Search: " + search.IsDone);
search.GetRemainingAsync((result)=> {
if (result.Exception != null) {
MogLog.Error("Get Error [" + typeof(T) + "]: " + result.Exception.Message + " , " + ((result.Exception.InnerException != null) ? result.Exception.InnerException.Message : ""));
if (onGet != null) {
onGet(null);
return;
}
} else {
// Debug.Log ("Search: " + search.IsDone);
if (onGet != null) {
onGet(result.Result);
}
}
});
}
/** Default Query only add filter on secondary range index */
public void QueryAll<T>(QueryOperationConfig queryOperation, Action<List<T>> onGet=null) {
Context.FromQueryAsync<T> (queryOperation, (search) => {
SearchAll(search, onGet);
}, null);
}
I get this problem with Unity 5.4.0f3, too, but only for iOS builds.
I also get this error with PutItem.
I'm having the same issue. The DynamoDB SDK for Unity is completely broken for iOS, starting with 5.3.6, and still broken in 5.4.0.
It works fine in version 5.3.5 and for all versions on Unity PC and .Net PC.
More details...
Fails for DynamoDBContext.LoadAsync() and IAmazonDynamoDB.GetItemAsync().
https://forums.aws.amazon.com/thread.jspa?threadID=237415&tstart=0
https://issuetracker.unity3d.com/issues/ios-amazon-web-services-error-on-ios
Fails for DynamoDBContext.LoadAsync() and IAmazonDynamoDB.GetItemAsync().
Only one datatype is being set.
Supplied AttributeValue has more than one datatypes set, must contain exactly one of the supported datatypes at AWSSDK.Core
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
1:m__A(AmazonServiceResult2)
Amazon.Runtime.AmazonServiceCallback2:Invoke(AmazonServiceResult2)
Amazon.DynamoDBv2.c__DisplayClass37_0:
System.Action`4:Invoke(T1, T2, T3, T4)
Amazon.Runtime.Internal.UnityMainThreadDispatcher:ProcessRequests()
Amazon.Runtime.Internal.UnityMainThreadDispatcher:Update()
Some sample code to reproduce error:
var request = new GetItemRequest
{
TableName = tableName,
Key = new Dictionary<string, AttributeValue>()
{
{ partKeyName, new AttributeValue { S = partKeyValue } }
}
};
_ddbClient.GetItemAsync(request, (result)=>
{
...
});
BTW, this should definitely be marked as a bug.
New details here from OLESVIPERSEP:
https://issuetracker.unity3d.com/issues/ios-amazon-web-services-error-on-ios
OLESVIPERSEP 01, 2016 22:54
Same problem here, I captured the http requests and noticed that the attribute values of the request are different on iOS compared to Android.Android:
{"AttributeUpdates":{"Something":{"Action":"PUT","Value":{"N":"1862"}}
},"Key":{"ID":{"S":"10208494337789794"}
},"ReturnValues":"NONE"
,"TableName":"MyTable"}iOS:
{"AttributeUpdates":{"Something":{"Action":"PUT","Value":{"BOOL":false,"N":"1862"}}
},"Key":{"ID":{"BOOL":false,"S":"10208494337789794"}
},"ReturnValues":"NONE"
,"TableName":"MyTable"}Response on iOS from dynamodb:
{ "__type":"com.amazon.coral.validate#ValidationException"
,"message":"Supplied AttributeValue has more than one datatypes set, must contain exactly one of the supported datatypes"}So somehow there is a BOOL AttributeValue added, that should not be there.
Fixed in Unity 5.4.1f1!!!
Closing for lack of activity
I just ran into this error in the node sdk today... Any idea what's causing this?
I am using the DocumentClient class in AWS.DynamoDB, and running:
await docClient.batchWrite(batchWriteItemRequest).promise();
I get:
ValidationException: Supplied AttributeValue has more than one datatypes set, must contain exactly one of the supported datatypes
Can you assist?
@andrewryan1906, I got this same error with batchWrite on DocumentClient.
The problem took a while to track down. It turned out that I was passing an object instead of an array under the <TableName> key.
What eventually cracked the case was looking at the raw request after the DocumentClient translation:
const request = docClient.batchWrite(batchWriteItemRequest)
request.on('sign', req => console.log(JSON.parse(req.httpRequest.body)))
await request.promise()
Wanted to record the cause here in case anyone else comes across this thread.
Most helpful comment
@andrewryan1906, I got this same error with
batchWriteon DocumentClient.The problem took a while to track down. It turned out that I was passing an object instead of an array under the
<TableName>key.What eventually cracked the case was looking at the raw request after the DocumentClient translation:
Wanted to record the cause here in case anyone else comes across this thread.