Aws-sdk-net: Unity2017.3 , aws lambda sdk can not use long string.

Created on 20 Dec 2017  路  11Comments  路  Source: aws/aws-sdk-net


when I use unity 2017.3 , I can not use long string.
it occur exception.

Amazon.Lambda.AmazonLambdaException: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

Expected Behavior

Current Behavior





Possible Solution


Steps to Reproduce (for bugs)

send any long message, about 2000 charactor , to lambda using unity aws sdk.

ResultText.text = "Invoking '" + FunctionNameText.text + " function in Lambda... \n";
string text = @"{""key1"":""aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"" }";

        Debug.Log("text.legnth "+ text.Length);

        Client.InvokeAsync(new Amazon.Lambda.Model.InvokeRequest()
        {
            FunctionName = "HelloLamda",
            Payload = text
        },
        (responseObject) =>
        {
            ResultText.text += "\n";
            if (responseObject.Exception == null)
            {
                ResultText.text += Encoding.ASCII.GetString(responseObject.Response.Payload.ToArray()) + "\n";
            }
            else
            {
                ResultText.text += responseObject.Exception + "\n";
            }
        }
        );

Context

Your Environment

I just used 'AWSSDK.Lambda.3.3.10.0.unitypackage'
and Unity 2017.3

.NET Core Info

  • .NET Core version used for development:
  • .NET Core version installed in the environment where application runs:
  • Output of dotnet --info:
  • Contents of project.json/project.csproj:
    .net 3.5 and .net 4.6
Unity closed-for-staleness

Most helpful comment

@kvasukib
I understood how to avoid this error.
You can avoid errors by setting UnitWebRequest.chunkedTransfer to false.
I'd like to ask you to fix it with AWSSDK.

I responded by the following method.

UnityInitializer.AttachToGameObject(gameObject);
gameObject.AddComponent<CustomUnityMainThreadDispatcher>();

CustomUnityMainThreadDispatcher.cs
https://gist.github.com/housei/b38cc93d6e8fe7caa2764d5b0dc34393

All 11 comments

After upgrading to Unity2017.3 and AWSSDK.Lambda.3.3.10.0.unitypackage, we also encountered a similar issue.

I can confirm that the issue is only occurring for a request with a 'heavy' payload.
Requests with smaller payloads continue to work properly as they used to...

Please let me know if I can provide any extra info that can help identify the cause of this issue...

After upgrading to Unity2017.3 I encountered a similar issue, but in my case I get the lambda exception with very short payload.

Thanks for reporting to us. We are looking into it.
@rams3s @amir-ahinoam @ulgerang Can you quantify the size of the string from which the calls to Lambda through Unity SDK fail? Was it working in older versions of Unity as in Unity 2017.2?

@kvasukib It is working in Unity 2017.2 . Using 2017.3,in my case, small string works fine, but long string make it fail.

@kvasukib in Unity 2017.2 & 2017.2.1 with AWSSDK.lambda 3.3.8.3 & 3.3.10.0 it works fine. With Unity 2017.3 it fails for payload as short as 68 chars.

Thanks, @ulgerang, and @amir-ahinoam. We are investigating.

even stranger, on my side for the same given payload it will not always fail... 1 out of 4/5 requests would work. update: not anymore this morning !...
update: connecting via my home network if will always fail, connecting via my 3G network it will work 1 out of 4/5 times Could be the ways headers are handled on the way?

Could this be a similar problem as issue #823 ?

@kvasukib
I understood how to avoid this error.
You can avoid errors by setting UnitWebRequest.chunkedTransfer to false.
I'd like to ask you to fix it with AWSSDK.

I responded by the following method.

UnityInitializer.AttachToGameObject(gameObject);
gameObject.AddComponent<CustomUnityMainThreadDispatcher>();

CustomUnityMainThreadDispatcher.cs
https://gist.github.com/housei/b38cc93d6e8fe7caa2764d5b0dc34393

For me, it gives error quite often but not always. So what I do, is send the request repeatedly. It gives the error like 7-8 times and then succeeds. But screen waits for that long time. So it is really a show stopper for user experience. My launch is waiting for the resolution of this bug. I won't even do the alpha launch of my game without it being fixed.

So please guys.. Make it a priority...

We have noticed this issue has not recieved attention in a year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.

Was this page helpful?
0 / 5 - 0 ratings