Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joost Broekhuizen 6 posts 26 karma points
    Mar 16, 2022 @ 11:51
    Joost Broekhuizen
    0

    Usync push content error

    Pulling settings and content from the server works fine. However when trying to push content from my local dev to the server I get the following error. Any thoughts on what could be wrong?

    Upload fail: a778ac1a-9f6b-426d-aa81-327170242b6b - {"code":500,"message":"Unexpected end of Stream, the content may have already been read by another component. ","exceptionMessage":"System.IO.IOException: Unexpected end of Stream, the content may have already been read by another component. \r\n   at Microsoft.AspNetCore.WebUtilities.MultipartReaderStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)\r\n   at Microsoft.AspNetCore.WebUtilities.StreamHelperExtensions.DrainAsync(Stream stream, ArrayPool`1 bytePool, Nullable`1 limit, CancellationToken cancellationToken)\r\n   at Microsoft.AspNetCore.WebUtilities.MultipartReader.ReadNextSectionAsync(CancellationToken cancellationToken)\r\n   at uSync.Publisher.Controllers.uSyncReceiveApiController.GetFileFromRequest(String folder)\r\n   at uSync.Publisher.Controllers.uSyncReceiveApiController.GetFileFromRequest(Boolean allowBlankGuid)\r\n   at uSync.Publisher.Controllers.uSyncReceiveApiController.PushPack()\r\n   at lambda_method14032(Closure , Object )\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"}
    at uSync.Publisher.Publishers.SyncPublisherBase.UploadFile(String url, Stream stream, uSyncCallbacks callbacks)
    

    at uSync.Publisher.Publishers.SyncRealtimePublisher.PushToServer(PublisherActionRequest request) at uSync.Publisher.Controllers.uSyncPublisherApiController.PerformAction(PublisherActionRequest request)

  • Kevin Jump 2146 posts 13582 karma points MVP 6x c-trib
    Mar 16, 2022 @ 11:56
    Kevin Jump
    0

    Hi,

    This can happen when other middleware reads the content stream in .netcore.

    by default the content stream in .netcore is non-rewindable (e.g. you can't seek back to the beginning once its been read.

    later versions of uSync.Complete have some mitigation for this. so if you update to v9.2.0 it might go away 🤞

    if not you either have to fix the offending middleware, or enable request buffering on the net project (the fix above enabled request buffering just on the uSync requests - to try fix this).

  • Joost Broekhuizen 6 posts 26 karma points
    Mar 16, 2022 @ 12:00
    Joost Broekhuizen
    0

    well we are already on 9.2.0, I'll try the request buffering, as I'm not aware of middleware interfering here, unless it is an Azure PaaS thing that is in the way, as our server is running on Azure.

  • Kevin Jump 2146 posts 13582 karma points MVP 6x c-trib
    Mar 16, 2022 @ 12:33
    Kevin Jump
    0

    The other possiblity (and we have seen this once - but i would say its rare) is that POST requests are getting their content stripped by filewall / proxy rules.

    the contents of this post request is a zip file and i think in the one case we saw something like that - the firewall did not allow uploading of "application/zip"

    so the request isn't actually getting anything when it gets there because something has stripped it.

  • Joost Broekhuizen 6 posts 26 karma points
    Mar 16, 2022 @ 13:10
    Joost Broekhuizen
    0

    We don't have a WAF or anything so I can't think of anything doing that. I was wondering if it could be some kind of MaxRequestSize setting that is exceeded as it works from Azure to Local, but not from Local to Azure.

  • Kevin Jump 2146 posts 13582 karma points MVP 6x c-trib
    Mar 16, 2022 @ 13:14
    Kevin Jump
    0

    Hi,

    It might be - but i would check with pushing a single page (no children/dependencies) in theory that should never go near the max request sizes that are defined so should work.

    but there are two max request size values we have in the config: https://github.com/Jumoo/uSync.Complete.Issues/issues/167

    to be honest i am not 100% sure if there might be azure ones you also have to set. but these set the internal max request sizes on requests to publisher.

  • Kevin Jump 2146 posts 13582 karma points MVP 6x c-trib
    Mar 16, 2022 @ 13:21
    Kevin Jump
    0

    Hi

    Just done a quick test to confirm v9.2 does work pushing to azure web apps.

    Do you have anything custom in startup.cs?, any additional packages installed? any custom auth stuff ?

  • Joost Broekhuizen 6 posts 26 karma points
    Mar 16, 2022 @ 13:24
    Joost Broekhuizen
    0

    Well we do have a custom AzureB2C login for visitors and AzureAd login for content editors.

    We have swagger/ui. And then some basics like cors, authentication etc.

    For umbraco the AzureBlobMediaFileStorage

  • Kevin Jump 2146 posts 13582 karma points MVP 6x c-trib
    Mar 16, 2022 @ 13:25
    Kevin Jump
    0

    If possible, can you exclude the /umbraco/uSyncReceive path from the Auth ? (not really sure how that might be done)

Please Sign in or register to post replies

Write your reply to:

Draft