dolittle / Home

Dolittle is a platform designed to build Line of Business applications without sacrificing architectural quality, code quality or scalability.
http://www.dolittle.io
MIT License
27 stars 5 forks source link

"Could not find file Core/wwwroot/index.html" when running a fresh project #69

Closed joelhoisko closed 3 years ago

joelhoisko commented 4 years ago

Env:

Ubuntu 19.04
@dolittle/cli 8.1.4
@dolittle/boilerplates.interaction.web.ts.aurelia@2.0.0
@dolittle/boilerplates.veracity.bounded-context.csharp@3.1.4
@dolittle/boilerplates.bounded-context.csharp@1.0.0
@dolittle/boilerplates.artifacts.csharp@1.0.0
@dolittle/boilerplates.application@3.0.0
@dolittle/tooling.plugin.dotnet-sdk@1.0.2
@dolittle/tooling.plugin.runtime@3.0.0
@dolittle/tooling.plugin.studio@1.0.0
.NET Core SDK 2.2.402
Project 'Core' has the following package references
   [netcoreapp2.2]:
   Top-level Package                                Requested   Resolved
   > Autofac.Extensions.DependencyInjection         4.2.0       4.2.0
   > Dolittle.AspNetCore                            7.*         7.0.8
   > Dolittle.AspNetCore.Debugging.Swagger          3.*         3.0.10
   > Dolittle.Build.MSBuild                         4.*         4.10.0
   > Dolittle.DependencyInversion.Autofac           4.*         4.10.0
   > Dolittle.ReadModels.MongoDB                    4.*         4.0.14
   > Dolittle.Runtime.Events.MongoDB                4.*         4.0.17
   > Dolittle.SDK                                   4.*         4.2.9
   > Dolittle.SDK.Build                             4.*         4.2.9
   > Microsoft.AspNetCore.All                       2.0.5       2.0.5
   > Microsoft.NETCore.App                    (A)   [2.2.0, )   2.2.0

I'm creating a blank new dolittle application and bounded context using the CLI and I'm trying to run it.

dolittle create application MyApp
dolittle create boundedcontext MyBound

I build the frontend first (after having fixed the capitalization). Then I run the backend from the Core folder using dotnet run and it runs.

But when I go to localhost:5000 I get greeted with this error both in the browser and the terminal:

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
      An unhandled exception has occurred while executing the request
System.IO.FileNotFoundException: Could not find file '/home/joel/Dolittle/TutorialExample/temp/MyBound/Core/wwwroot/index.html'.
File name: '/home/joel/Dolittle/TutorialExample/temp/MyBound/Core/wwwroot/index.html'
   at System.IO.FileInfo.get_Length()
   at Microsoft.AspNetCore.Http.SendFileResponseExtensions.SendFileAsyncCore(Stream outputStream, String fileName, Int64 offset, Nullable`1 count, CancellationToken cancel)
   at Microsoft.AspNetCore.Http.SendFileResponseExtensions.SendFileAsyncCore(HttpResponse response, IFileInfo file, Int64 offset, Nullable`1 count, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Builder.ApplicationBuilderExtensions.<>c__DisplayClass1_0.<<RunAsSinglePageApplication>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Dolittle.AspNetCore.Bootstrap.HealthCheckMiddleware.InvokeAsync(HttpContext context)
   at Dolittle.AspNetCore.Execution.ExecutionContextSetup.InvokeAsync(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 35.122ms 500 text/html; charset=utf-8

Probably linked to the boilerplates for C#.

┆Issue is synchronized with this Asana task

woksin commented 4 years ago

This may be related to the typescript build stuff we have. It's not anything wrong in the boilerplate itself. Maybe hear with @pavsaund or @smithmx

ghost commented 4 years ago

➤ Einar Ingebrigtsen commented:

Should we promote a developer experience which requires the SPA to not be hosted from the ASP.NET Core Kestrel Web Server. This would then be from a learning perspective and documentation a more modular experience as the backend is then separate. That means that the Boilerplate should be updated with the WebPack DevServer having the proxying enabled to forward our Query/Command posts through that - as we've done for the Banking example: https://github.com/dolittle-samples/Bank/blob/master/Source/Banking/Web/webpack.config.js

joelhoisko commented 4 years ago

Going to locahost:5000/swagger works normally still, it's just that going to localhost:5000 breaks.

joelhoisko commented 4 years ago

Adding this line to webpack.config.js before the webpack is called fixes the error, the page is still blank for some other reason but it's at least something.

process.env.DOLITTLE_WEBPACK_OUT = path.resolve("../Core/wwwroot/");

Probably has something to do with this line? Not sure where to fix this problem, we could do it dirty and just change the webpack.config.js boilerplate but that doesn't seem quite correct.

joelhoisko commented 4 years ago

Using yarn start seems to be better in the way that it actually shows you the aurelia errors you're getting in the console. Using yarn build with the Core/wwwroot/ path set doesn't show errors in aurelia, making debugging really hard.