Closed SteveDesmond-ca closed 2 years ago
Minimal repro is just about as minimal as it can get!
Program.cs
:
using Statiq.App;
using Statiq.Web;
await Bootstrapper.Factory
.CreateDefaultWithout(args, DefaultFeatures.Pipelines)
.AddWeb()
.DeployToGitHubPages("test", "test", "test")
.RunAsync();
Deployment fails but exit code of dotnet run -- deploy
is 0
Interesting. I think there are two things going on (both are bad!):
[ERRO] Deployment/Output » ExecuteIf » ExecuteIf » DeployGitHubPages » Server Error
. That's not very descriptive 😕. In general I've found GitHub Pages deployments to be wonky. Usually when they fail for me it's because I trigger API limits and get flagged as abuse. That happens more for big sites, and I've added some things like throttling to try and improve it, but still can't quite seem to entirely eliminate the possibility. But this doesn't look like that given the more vague error message. First thing I'll do here is add some better logging - look for a new release shortly with that.Stay tuned - I'll drop a note here when a new release is out (hopefully shortly). Hopefully with some better logging we can figure out why the deployment is failing in addition to knowing that it's failing.
I found it -- the async
/await
s inside of github.ThrottleAsync()
in DeployGitHubPages.ExecuteConfigAsync()
(link) are swallowing the exception. Removing them (like is done at the bottom of the file) fixes this issue.
PR incoming later this afternoon for review.
Interesting! Now I've got to wrap my head around why that would be the case. The ThrottleAsync()
method takes a Task
-returning function, so when we omit the async
/await
it's passing in the actual Task
from the called method, which then gets awaited inside the ThrottleAsync()
method. However, when we pass in an async lambda like in the problematic code, we await the lambda itself within the ThrottleAsync()
method, which then awaits the called method. My intuition is that shouldn't impact exception catching other than adding the extra lambda to the call stack.
I'm clearly missing something! Now I've been successfully nerd snipped and can't rest until I fully understand what's going on here.
Hmm...they both seem to throw correctly as I'd expect:
lol it's like we're pairing and finding the same issues simultaneously...indeed, I think the problem may be in my code
Yep, there's even a corresponding problem in my "minimal" repro -- it's a little too minimal:
Program.cs
:
using Statiq.App;
using Statiq.Web;
await Bootstrapper.Factory
.CreateDefaultWithout(args, DefaultFeatures.Pipelines)
.AddWeb()
.DeployToGitHubPages("test", "test", "test")
.RunAsync();
Process finished with exit code 0.
vs
Program.cs
:
using Statiq.App;
using Statiq.Web;
return await Bootstrapper.Factory
.CreateDefaultWithout(args, DefaultFeatures.Pipelines)
.AddWeb()
.DeployToGitHubPages("test", "test", "test")
.RunAsync();
Process finished with exit code 1.
Apologies for the rabbit hole!
I think the problem may be in my code
I'm not really seeing anything in the project that jumps out as suspect (unless this only started with some uncommitted code or code in a branch?). It all looks pretty straightforward, I.e. nothing exotic with changing inbox pipelines or anything.
Oh my gosh! Haha - so it just wasn't returning the exit code. It's always the blindingly obvious things :)
Apologies for the rabbit hole!
No worries at all - async/await is tough enough to get right that validating assumptions and experimenting with it is an absolutely good exercise every so often.
Plus if nothing else more supporting evidence for why I'm against top-level statements :grimacing:
Steps to reproduce:
dotnet run -- deploy
from the app root dir(I'll try to find a more minimal repro, but for now here's the most recent time I've hit this)
Expected result:
Observed result:
Notes: