question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.Exception: Unable to load bundles (HTTP 500 on initial load web UI)

See original GitHub issue

After successful installation and startup of BTCPay server, an error occurs the first time I try to access the web UI on port 23001. HTTP 500 is returned to the web client and a System Exception occurs in the btcpay logs (logs at the end of this issue)

  • Version of BTCPay Server: v1.0.3.88 (also failing for several other 1.0.3.xx versions tested)
  • Deployment method: Manual Build
  • Other relevant environment details: Ubuntu 16.04

To Reproduce

  • Build and run BTCPay from systemctl startup script
  • BTCPay uccessfully connects to NBXplorer and sees new blocks
  • BTCPay starts HTTP server on 23001
  • On initial HTTP get of localhost:23001, HTTP500 is returned.
  • Logs show system exception in LoadBundles()

Additional details:

  • BTCPay server is running as a non-administrative user.
  • daemon user and group have full access to the btcpayserver build and launch directory
  • It worked before “bundles”
  • Crash happens even when bundlejscss is set to false
  • Additional logging added to the code shows that bundlejscss is correctly read as “false” in the daemon execution.
  • Daemon user has full file access to bundleconfig.json
  • Even when setting 777 permisions on bundleconfig.json, it still crashes
 System.Exception: Unable to load bundles.
    at Meziantou.AspNetCore.BundleTagHelpers.BundleProvider.LoadBundles()
    at Meziantou.AspNetCore.BundleTagHelpers.BundleProvider.GetBundle(String name)
    at Meziantou.AspNetCore.BundleTagHelpers.BundleTagHelper.Process(TagHelperContext context, TagHelperOutput output)
    at Microsoft.AspNetCore.Razor.TagHelpers.TagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
    at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.RunAsync(TagHelperExecutionContext executionContext)
    at AspNetCore.Views_Shared__Layout.<ExecuteAsync>b__44_0() in /usr/local/src/BTCPayServer/btcpayserver/BTCPayServer/Views/Shared/_Layout.cshtml:line 27
    at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
    at AspNetCore.Views_Shared__Layout.ExecuteAsync()
    at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
    at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
    at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
    at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
    at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
    at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
    at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
    at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync[TFilter,TFilterAsync]()
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters()
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
    at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
    at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
    at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
    at BTCPayServer.Hosting.BTCPayMiddleware.Invoke(HttpContext httpContext) in /usr/local/src/BTCPayServer/btcpayserver/BTCPayServer/Hosting/BTCpayMiddleware.cs:line 55
    at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:23 (19 by maintainers)

github_iconTop GitHub Comments

2reactions
aantonopcommented, Mar 29, 2019

I managed to isolate the problem to the systemd start script. I copied from the run.sh contents and this command line worked:

ExecStart=/usr/bin/dotnet run --no-launch-profile --no-build -c Release -p "BTCPayServer/BTCPayServer.csproj" --conf /data/btcpayserver/btcpayserver.conf --datadir /data/btcpayserver/

The problem was all in how I launched BTCPay from systemd. I had copied the systemd from one of the tutorials, and it didn’t work.

2reactions
NicolasDoriercommented, Mar 24, 2019

Yep, I confirm it works for me now. 😃 @aantonop if you use bundlejscss to true (as it should be normally), you won’t have permission issue as I read the bundle.config directly from the resources of the assembly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP Error 500: localhost is currently unable to handle this ...
I got the following error hosing an ASP.NET Core 3.1 application on IIS 10.0 after following this guide:.
Read more >
Site fails to load with HTTP 500 error
Web interface site fails to load with one of the the following HTTP 500 Exceptions: System.InvalidCastException: Unable 4245358.
Read more >
What is “HTTP 500 Internal Server Error” and How to Fix It?
Error 500, also known as the Internal Server Error, is a common HTTP status code that indicates an issue on the web server's...
Read more >
Server Error (500) Occurs
When working with Telerik UI for ASP.NET AJAX, a 500 server error occurs. Find other useful information in the Knowledgebase section of the...
Read more >
HTTP 500 Internal Server Error: What It Means & How to Fix It
A 500 internal server error is, as the name implies, a general problem with the website's server. More than likely, this means there's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found