Open
Description
Describe the bug
SynthesizeSpeechAsync method does not work in Unity WebGL builds. And returns a console error about stream being null.
Expected Behavior
Getting a successful response.
Current Behavior
WebGL.framework.js.gz:3 ArgumentNullException: Value cannot be null.
Parameter name: stream
at System.IO.StreamReader..ctor (System.IO.Stream stream, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize, System.Boolean leaveOpen) [0x00000] in <00000000000000000000000000000000>:0
at System.IO.StreamReader..ctor (System.IO.Stream stream, System.Boolean detectEncodingFromByteOrderMarks) [0x00000] in <00000000000000000000000000000000>:0
at System.IO.StreamReader..ctor (System.IO.Stream stream) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Internal.RegionEndpointProviderV3..ctor () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.RegionEndpoint.get_RegionEndpointProvider () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.RegionEndpoint.get_InternedRegionEndpoint () [0x00000] in <00000000000000000000000000000000>:0
at Amazon.RegionEndpoint.GetEndpointForService (System.String serviceName, Amazon.Internal.GetEndpointForServiceOptions options) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Auth.AWS4Signer.DetermineSigningRegion (Amazon.Runtime.IClientConfig clientConfig, System.String serviceName, Amazon.RegionEndpoint alternateEndpoint, Amazon.Runtime.Internal.IRequest request) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Auth.AWS4Signer.SignRequest (Amazon.Runtime.Internal.IRequest request, Amazon.Runtime.IClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, System.String awsAccessKeyId, System.String awsSecretAccessKey) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Auth.AWS4Signer.Sign (Amazon.Runtime.Internal.IRequest request, Amazon.Runtime.IClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, System.String awsAccessKeyId, System.String awsSecretAccessKey) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Auth.AWS4Signer.Sign (Amazon.Runtime.Internal.IRequest request, Amazon.Runtime.IClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, Amazon.Runtime.ImmutableCredentials credentials) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Auth.AbstractAWSSigner.SignAsync (Amazon.Runtime.Internal.IRequest request, Amazon.Runtime.IClientConfig clientConfig, Amazon.Runtime.Internal.Util.RequestMetrics metrics, Amazon.Runtime.ImmutableCredentials credentials, System.Threading.CancellationToken token) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Signer.SignRequestAsync (Amazon.Runtime.IRequestContext requestContext) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Signer.SignRequestAsync (Amazon.Runtime.IRequestContext requestContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Signer.PreInvokeAsync (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Signer.PreInvokeAsync (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Signer.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Signer.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<>n__0[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.CredentialsRetriever.<>n__0[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.RetryHandler.<>n__0[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.CallbackHandler.<>n__0[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.BaseEndpointResolver.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.Marshaller.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.PipelineHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00000] in <00000000000000000000000000000000>:0
at Amazon.Runtime.Internal.CallbackHand
Reproduction Steps
Running the following code in Unity Editor and I can get back the audio result. However, the WebGL build will fail due to stream being null when the request is awaited.
var credentials = new BasicAWSCredentials(akey, skey);
var client = new AmazonPollyClient(credentials: credentials, region: RegionEndpoint.EUCentral1);
var request = new SynthesizeSpeechRequest()
{
OutputFormat = OutputFormat.Mp3,
VoiceId = VoiceId.Arthur,
Text = "Testing Polly."
};
var response = await client.SynthesizeSpeechAsync(request);
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Unity 2021.3.5f1
AWSSDK.Core.3.7.105.10
AWSSDK.Polly.3.7.106.31
Targeted .NET Platform
.NET Standard 2.1
Operating System and version
Windows 11