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)
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.
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.
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.
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.
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.
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?
at uSync.Publisher.Publishers.SyncRealtimePublisher.PushToServer(PublisherActionRequest request) at uSync.Publisher.Controllers.uSyncPublisherApiController.PerformAction(PublisherActionRequest request)
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).
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.
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.
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.
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.
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 ?
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
If possible, can you exclude the
/umbraco/uSyncReceive
path from the Auth ? (not really sure how that might be done)is working on a reply...