簡體   English   中英

Trinsic API(前 Streetcred)的錯誤 WebHook

[英]Error WebHook by Trinsic API (former Streetcred)

基本 .net 核心 web 應用程序在接收來自 TrinsicAPI 的 POST 請求(webhook)時拋出錯誤。

錯誤:Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException:錯誤的塊大小數據。

WebHook 的定義可以在這里找到: https://docs.trinsic.id/docs/webhooks-1

WebHook-Receiver 看起來像這樣:

[DisableRequestSizeLimit]
        [HttpPost]
        public async Task<ActionResult> Post([FromBody] WHPayloadModel payload)
        {
            // Do cool stuff
            // dummy Async method
            var test = await _client.ListWebhooksAsync();
            return Ok();
        }
public class WHPayloadModel
    {
        public enum WHMessage_Type
        {
            [EnumMember]
            new_connection,
            [EnumMember]
            credential_request,
            [EnumMember]
            verification,
            [EnumMember]
            new_inbox_Message
        }

        [DataMember]
        public String Message_Type { get; set; }

        [JsonProperty(PropertyName = "object_id")]
        public String Object_id { get; set; }

        [JsonProperty(PropertyName = "data")]
        public Dictionary<String, String> Data { get; set; } = new Dictionary<String, String>();
    }

即使我嘗試像這樣通過動態 object 捕獲請求 - 它仍然會引發相同的錯誤:

[HttpPost]
        public async Task<ActionResult> Post([FromBody] dynamic payload)
        {
            // Do cool stuff
            // dummy Async method
            var test = await _client.ListWebhooksAsync();
            return Ok();
        }

對於不同類型的項目 Blazor 項目或 WebAPI,錯誤保持不變。

> fail:
> Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
>       An unhandled exception has occurred while executing the request. **Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Bad
> chunk size data.**    at
> Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException.Throw(RequestRejectionReason
> reason)    at
> Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ChunkedEncodingMessageBody.CalculateChunkSize(Int32
> extraHexDigit, Int32 currentParsedSize)    at
> Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ChunkedEncodingMessageBody.ParseChunkedPrefix(ReadOnlySequence`1&
> buffer, SequencePosition& consumed, SequencePosition& examined)    at
> Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ChunkedEncodingMessageBody.Read(ReadOnlySequence`1
> readableBuffer, PipeWriter writableBuffer, SequencePosition& consumed,
> SequencePosition& examined)    at
> Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ChunkedEncodingMessageBody.PumpAsync()
> at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()    at
> System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)    at
> System.IO.Pipelines.Pipe.ReadAsync(CancellationToken token)    at
> System.IO.Pipelines.Pipe.DefaultPipeReader.ReadAsync(CancellationToken
> cancellationToken)    at
> Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ChunkedEncodingMessageBody.ReadAsyncInternal(CancellationToken
> cancellationToken)    at
> Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.ReadAsyncInternal(Memory`1
> buffer, CancellationToken cancellationToken)    at
> System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json,
> Type returnType, JsonSerializerOptions options, CancellationToken
> cancellationToken)    at
> Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonInputFormatter.ReadRequestBodyAsync(InputFormatterContext
> context, Encoding encoding)    at
> Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonInputFormatter.ReadRequestBodyAsync(InputFormatterContext
> context, Encoding encoding)    at
> Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinder.BindModelAsync(ModelBindingContext
> bindingContext)    at
> Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.BindModelAsync(ActionContext
> actionContext, IModelBinder modelBinder, IValueProvider valueProvider,
> ParameterDescriptor parameter, ModelMetadata metadata, Object value)  
> at
> Microsoft.AspNetCore.Mvc.Controllers.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---    at
> Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker
> invoker, Task lastTask, State next, Scope scope, Object state, Boolean
> isCompleted)    at
> Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker
> invoker, Task lastTask, State next, Scope scope, Object state, Boolean
> isCompleted)    at
> Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed
> context)    at
> Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State&
> next, Scope& scope, Object& state, Boolean& isCompleted)    at
> Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
> --- End of stack trace from previous location where exception was thrown ---    at
> Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker
> invoker, Task task, IDisposable scope)    at
> Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint
> endpoint, Task requestTask, ILogger logger)    at
> Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext
> context)    at
> Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext
> context)    at
> Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext
> context)    at
> Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext
> context)    at
> Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext
> httpContext)    at
> Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext
> httpContext)    at
> Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext
> context)

Post 請求使用 Postman API 工具工作。 因此,我確實使用傳送器.cloud 托管了開發應用程序,以便從 WAN 訪問它。

這是 POSTMAN POST 請求的定義

https://MyProjectName.conveyor.cloud/api/WebHook

身體的定義:

    {
    "message_type": "new_connection",
    "object_id": "00000000",
    "data": {
        "param1": "value1",
        "param2": "value2"
    }
}

在此處輸入圖像描述

所以錯誤似乎直接來自固有的 API。

WebHook 的觸發器是在創建 new_connection 時。

干杯!

問題來自 VSStudio 擴展服務 conveyour.cloud。

https://conveyor.cloud/Home/How_To_Install

這個問題應該很快就會解決,他們正在努力解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM