amazon-archives / aws-sdk-unity

ARCHIVED: The aws sdk for unity is now distributed as a part of aws sdk for dotnet:
https://github.com/aws/aws-sdk-net
Other
105 stars 43 forks source link

Error: Cannot overwrite header: User-Agent for DynamoDB - putItem #105

Closed marcumw closed 8 years ago

marcumw commented 8 years ago

Windows 7 / Unity 5.3 (also fails for versions 5.2.4 and 5.1.4) Me thinks it is a Visual Studio Tools for Unity issue as I do NOT get the error when running with same Unity versions in OS X. Any thoughts?

Query and scans work...but updates and inserts are failing.

ArgumentException: Cannot overwrite header: User-Agent UnityEngine.WWW.CheckSecurityOnHeaders (System.String[] headers) (at C:/buildslave/unity/build/Runtime/Export/WWW.cs:71) UnityEngine.WWW..ctor (System.String url, System.Byte[] postData, System.Collections.Generic.Dictionary`2 headers) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UtilsBindings.gen.cs:133) Amazon.Runtime.Internal.UnityMainThreadDispatcher+c__Iterator2.MoveNext () (at Assets/Plugins/AWSSDK/src/Core/Amazon.Runtime/Pipeline/_unity/UnityMainThreadDispatcher.cs:129) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) Amazon.Runtime.Internal.UnityMainThreadDispatcher:ProcessRequests() (at Assets/Plugins/AWSSDK/src/Core/Amazon.Runtime/Pipeline/_unity/UnityMainThreadDispatcher.cs:59)

johnnyhoffman commented 8 years ago

Hey, thanks for letting us know about this. I am not able to replicate the issue, though. Could you provide more information, like the parameters you are using for PutItem? Also, are you using the most recent version of the AWS SDK for Unity (2.1.0.0)?

marcumw commented 8 years ago

Sorry John for the delayed response. Yes I am using the latest SDK (2.1.0.0) Again I think it's a Visual Studio Unity Tools problem

johnnyhoffman commented 8 years ago

Understood. I have Visual Studio Tools for Unity set up as well, but that does not seem to be enough for me to reproduce the error. Perhaps performing PutItem in the exact way that you are would allow me to reproduce the error. Could you provide me with some of the code you use to perform PutItem, i.e.

Client.PutItemAsync(new PutItemRequest()
{
 <<your properties>> ...
} ...
marcumw commented 8 years ago

John

I should clarify that it's not just PutItem but any DynamoDB action...the QueryAsync code below returns the exact same error. I use the same code between my PC and Mac so the fact that it works on my Mac is so strange. I am not even sure if this is something you can fix as it might be some network setting or Visual Studio configuration on my windows box that I am not aware of.

   QueryRequest request = new QueryRequest("Atlases");

    //Dictionary<string, AttributeValue> dictResults = null;

    request.KeyConditions = new Dictionary<string, Condition>()
    {
        {
            "id",  new Condition()
            {
                ComparisonOperator = "EQ",
                AttributeValueList = new List<AttributeValue>()
                {
                    new AttributeValue { S = _currAtlas._guid }
                }
            }
        }
    };

    request.AttributesToGet = new List<string>() { "title", "name",

"texturesByMonth", "countPosts", "countPhotos" }; request.ConsistentRead = true; request.Limit = 2; // The Reply table has only a few sample items. So the page size is smaller. //request.ExclusiveStartKey = dictResults; request.ReturnConsumedCapacity = "TOTAL";

    Client.QueryAsync(request, (result) => {

        try
        {
            ManagerGui.setDebugText("");

            string countPhotos =

result.Response.Items[0]["countPhotos"].N;

            JSONNode json =

JSONNode.Parse(result.Response.Items[0]["texturesByMonth"].S);

            _currAtlas._timeGroups = new TimeGroups(json["dict"]);

        }
        catch (System.Exception ex)
        {
            string error = ex.Message;
        }

    });

On Tue, Dec 15, 2015 at 7:03 PM, Johnny Hoffman notifications@github.com wrote:

Understood. I have Visual Studio Tools for Unity set up as well, but that does not seem to be enough for me to reproduce the error. Perhaps performing PutItem in the exact way that you are would allow me to reproduce the error. Could you provide me with some of the code you use to perform PutItem, i.e.

'''

Client.PutItemAsync(new PutItemRequest() { <> ... } '''

— Reply to this email directly or view it on GitHub https://github.com/aws/aws-sdk-unity/issues/105#issuecomment-164950344.

Marcum Williams 773.715.9238

jdmiranda commented 8 years ago

might i suggest you create a new project and import the dynamodb package. then test it on mac and windows. a few questions too. which build platform are you using. also check the sln settings and make sure your targeting the correct .net versions. you should also try using monodevelop on windows just to see if it fixes this problem. last thing is click assets from unity3d ide and click open c# project. this will sync the project to unity and fixes reference issues sometimes. if you can verify the bug on a test project you can push that to github and the community can look at it.

marcumw commented 8 years ago

Jeremy

Thanks for the suggestions. After creating a new project it became apparent that in Unity the default build target when working / testing in the Editor is set to "Web player". Switching build target to pc / mac / standalone fixed the issue. Very sorry the goose chase.

Ref => http://answers.unity3d.com/questions/574182/cookie-header-with-webplayer-unity3d-43.html

On Tue, Dec 15, 2015 at 8:09 PM, Jeremy notifications@github.com wrote:

might i suggest you create a new project and import the dynamodb package. then test it on mac and windows. a few questions too. which build platform are you using. also check the sln settings and make sure your targeting the correct .net versions. you should also try using monodevelop on windows just to see if it fixes this problem. last thing is click assets from unity3d ide and click open c# project. this will sync the project to unity and fixes reference issues sometimes. if you can verify the bug on a test project you can push that to github and the community can look at it.

— Reply to this email directly or view it on GitHub https://github.com/aws/aws-sdk-unity/issues/105#issuecomment-164963816.

Marcum Williams 773.715.9238