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>();
    }

即使我像这样尝试通过动态对象捕获请求 - 它仍然会抛出相同的错误:

[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 工具工作。因此,我确实使用 conveyor.cloud 托管开发应用程序以从 WAN 访问它。

这是 POSTMAN POST 请求的定义

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

正文定义:

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

所以错误似乎直接来自 trinsic API。

WebHook 的触发器是在创建 new_connection 时。

干杯!

问题来自 VSStudio 扩展服务 conveyour.cloud。

https://conveyor.cloud/Home/How_To_Install

问题应该很快就会解决,他们正在努力修复。