How to migrate from local folder asset store to GridFS


#1

I want to start using GridFS to be able to back up and restore assets directly from mongoDump. But as I already have my assets “uploaded” to the local Squidex instalation, so… I should delete my assets, change the settings to GridFS and then re-upload?
Thanks


#2

I’m trying to upload assets on a new squidex app with the GridFS setting, im getting this error while trying to upload

{
“logLevel”: “Error”,
“message”: “Connection id “0HLLO70APSKE7”, Request id “0HLLO70APSKE7:00000008”: An unhandled exception was thrown by the application.”,
“eventId”: {
“id”: 13,
“name”: “ApplicationError”
},
“connectionId”: “0HLLO70APSKE7”,
“traceIdentifier”: “0HLLO70APSKE7:00000008”,
“exception”: {
“type”: “System.NotSupportedException”,
“message”: “Specified method is not supported.”,
“stackTrace”: " at Squidex.Infrastructure.Assets.NoopAssetStore.UploadAsync(String fileName, Stream stream, CancellationToken ct) in C:\Users\Jose Santiago\Documents\new-senae-cms\src\Squidex.Infrastructure\Assets\NoopAssetStore.cs:line 34\r\n at Squidex.Domain.Apps.Entities.Assets.AssetCommandMiddleware.HandleAsync(CommandContext context, Func1 next) in C:\\Users\\Jose Santiago\\Documents\\new-senae-cms\\src\\Squidex.Domain.Apps.Entities\\Assets\\AssetCommandMiddleware.cs:line 63\r\n at Squidex.Domain.Apps.Entities.Apps.InviteUserCommandMiddleware.HandleAsync(CommandContext context, Func1 next) in C:\Users\Jose Santiago\Documents\new-senae-cms\src\Squidex.Domain.Apps.Entities\Apps\InviteUserCommandMiddleware.cs:line 47\r\n at Squidex.Web.CommandMiddlewares.EnrichWithSchemaIdCommandMiddleware.HandleAsync(CommandContext context, Func1 next) in C:\\Users\\Jose Santiago\\Documents\\new-senae-cms\\src\\Squidex.Web\\CommandMiddlewares\\EnrichWithSchemaIdCommandMiddleware.cs:line 54\r\n at Squidex.Web.CommandMiddlewares.ETagCommandMiddleware.HandleAsync(CommandContext context, Func1 next) in C:\Users\Jose Santiago\Documents\new-senae-cms\src\Squidex.Web\CommandMiddlewares\ETagCommandMiddleware.cs:line 55\r\n at Squidex.Infrastructure.Commands.InMemoryCommandBus.PublishAsync(ICommand command) in C:\Users\Jose Santiago\Documents\new-senae-cms\src\Squidex.Infrastructure\Commands\InMemoryCommandBus.cs:line 40\r\n at Squidex.Areas.Api.Controllers.Assets.AssetsController.PostAsset(String app, List1 file) in C:\\Users\\Jose Santiago\\Documents\\new-senae-cms\\src\\Squidex\\Areas\\Api\\Controllers\\Assets\\AssetsController.cs:line 182\r\n at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ExceptionContext context)\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()\r\n at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()\r\n at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)\r\n at NSwag.AspNetCore.Middlewares.SwaggerDocumentMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)\r\n at Squidex.Web.Pipeline.EnforceHttpsMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\\Users\\Jose Santiago\\Documents\\new-senae-cms\\src\\Squidex.Web\\Pipeline\\EnforceHttpsMiddleware.cs:line 28\r\n at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)\r\n at Squidex.Web.Pipeline.LocalCacheMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\\Users\\Jose Santiago\\Documents\\new-senae-cms\\src\\Squidex.Web\\Pipeline\\LocalCacheMiddleware.cs:line 30\r\n at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Squidex.Web.Pipeline.RequestLogPerformanceMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\\Users\\Jose Santiago\\Documents\\new-senae-cms\\src\\Squidex.Web\\Pipeline\\RequestLogPerformanceMiddleware.cs:line 33\r\n at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)"
},
“app”: {
“name”: “Squidex”,
“version”: “1.0.0.0”,
“sessionId”: “37e217c1-0f08-446e-8f50-d306f93106d1”
},
“web”: {
“requestId”: “5f52874f-0d51-4d51-85ef-6504fb485b0b”,
“requestPath”: “/api/apps/senae-cms/assets”,
“requestMethod”: “POST”
},
“timestamp”: “2019-04-03T13:28:25Z”,
“category”: “Microsoft.AspNetCore.Server.Kestrel”
}


#3

Perhaps you can upload the assets from the folder directly to GridFS. The naming is the same.

What is your setting (type) for the asset store?


#4

on my project i have “Folder”, but in the new one i have GridFS. I created a new database called SquidexAsset where I assumed the assets would store.


#5

The type is MongoDb not GridFS


#6

I feel so dumb right now, thanks a lot for the help and sorry


#7

You are welcome…I should log a warning when the NoopStore is selected.