AWS Lambda .net Core s3文件下载开始,出现此错误“ SSL对等证书或SSH远程密钥不正确”

时间:2019-07-03 04:17:35

标签: .net-core aws-lambda

以点网核心1.0编写的AWS Lambda从过去2年开始工作,从昨天开始在s3 GetObjectAsync方法中出现上述错误。

下面是运行lambda的环境 语言-C#运行时.NET Core 1.0操作系统-Amazon Linux

请在此处找到错误和堆栈跟踪

错误:发送请求时发生错误。

内部异常System.Net.Http.CurlException:SSL对等证书或SSH远程密钥不正确 在System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode错误) 在System.Net.Http.CurlHandler.MultiAgent.FinishRequest(StrongToWeakReference`1 easyWrapper,CURLcode messageResult)

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess上的堆栈跟踪(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在System.Net.Http.HttpClient.d__58.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.Runtime.HttpWebRequestMessage.d__20.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.Runtime.Internal.HttpHandler 1.<InvokeAsync>d__9 1.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.Runtime.Internal.RedirectHandler.d__1 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.Runtime.Internal.Unmarshaller.<InvokeAsync>d__3 1.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.S3.Internal.AmazonS3ResponseHandler.d__1 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5 1.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.Runtime.Internal.CallbackHandler.d__9 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.Runtime.Internal.CredentialsRetriever.<InvokeAsync>d__7 1.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.Runtime.Internal.RetryHandler.d__10 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10 1.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.Runtime.Internal.CallbackHandler.d__9 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9 1.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.S3.Internal.AmazonS3ExceptionHandler.d__1 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5 1.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在Amazon.Runtime.Internal.MetricsHandler.d__1`1.MoveNext() ---从之前引发异常的位置开始的堆栈结束跟踪--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在_7433_iDigi_FileManager.iDigiS3.d__7.MoveNext()

        {
            try
            {
                GetObjectResponse getObjectResponse = null;
                if (!string.IsNullOrEmpty(bucketName) && !string.IsNullOrEmpty(folderPath) && !string.IsNullOrEmpty(fileName))
                {
                    var getObjectRequest = new GetObjectRequest
                    {
                        BucketName = bucketName + "/" + folderPath,
                        Key = fileName
                    };

                    getObjectResponse = await
                        S3Client.GetObjectAsync(getObjectRequest);
                }
                else
                {
                    if (string.IsNullOrEmpty(bucketName))
                    { context.Logger.Log($"ERROR: The passed bucket name is null or empty {bucketName}"); }
                    if (string.IsNullOrEmpty(folderPath))
                    { context.Logger.Log($"ERROR: The passed folder path is null or empty {folderPath}"); }
                    if (string.IsNullOrEmpty(fileName))
                    { context.Logger.Log($"ERROR: The passed file name is null or empty {fileName}"); }
                }

                return getObjectResponse;
            }
            catch (Exception e)
            {
                context.Logger.Log($"Error:Exception occured while trying to get the file, error message -{e.Message}");
                context.Logger.Log($"Error: Inner exception message -{e.InnerException}");
                context.Logger.Log($"Error: Stack trace -{e.StackTrace}");
                return null;
            }

        }```

0 个答案:

没有答案