-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish failed #2
Comments
Thank you for reporting! But unfortunately, I found out Anyway, we can progress static pre-rendering task of At first, please update the package reference to this package to v.1.0.0-preview.6. Second, maybe you already know, the Before:
After:
After doing the above steps, the However, the result of static pre-rendering will be empty....! Because, when the request URL is "/", your And also, when the request URL is "/en-US", the server-side rendering process will crash with an unhandled exception. (After initial launched of the If you fix the crash of the |
@jsakamoto I appreciate your time in creating this project. I tried this with brand new Publishing Log:
Output log:
Project Repo Link - https://github.com/fingers10/BlazorWasmPreRenderGitDeploy Please can you assist me on this? |
@fingers10 Thank you for your feedback! I want to make the "BlazorWasmPreRendering.Build" work well on your scenario. I appreciate you if you will be patiently waiting to finish my work. |
@jsakamoto thanks for the inputs. I'll wait for the solution. Please could you let me know what is the issue here? |
Yes, of course, but I have no idea at this time. However, you have disclosed your repository to me that can reproduce failing. It is much helpful to resolve this issue! |
[Progress Report] Sorry too late but recently I've been able to try to resolve your problem. And I found the problem can be reproduced when I execute publishing the project with Visual Studio 2022. I'm currently working on this issue, and I think I can finally resolve that unhandled exception error. |
I did it! Could you try the latest version of the "BlazorWasmPreRendering.Build" out? |
Many thanks for your time and response. This works for simple project. But If we have a parameter of Type Error:
Project Repo Link - https://github.com/fingers10/PrerenderTest |
The pre-rendering process invokes your In this case, if you simply remove the 3rd argument from the But, I've guessed that you want to do something by using the 3rd The current version of "BlazorWasmPreRendering.Build" has no that ability, but I'll consider improving this library to be able to provide |
I have appsettings.json in my wwwroot and I'm binding some configuration from that and hence I need acces to configuration. I tried with IConfiguration instead of WebAssemblyHostConfiguration. The code compiles without any error but fails on publish. Please can you assist? |
Yeah, the current version of "BlazorWasmPreRendering.Build" cannot provide the So, I'll improve "BlazorWasmPreRendering.Build" and make it be able to provide the Would you please give me more days to improve it if you hope it? Anyway, thank you for letting me know your scenario! 👍 |
Sure. I'll wait for it. Happy to hear back. |
I published the new version of "BlazorWasmPreRendering.Build". This version will provide an Please update the package version, and please rewrite your From: static void ConfigureServices(..., WebAssemblyHostConfiguration configuration)
{
... To: static void ConfigureServices(..., IConfiguration configuration)
{
... By the way, please remember that the pre-rendering process is a normal ASP.NET Core server-side process. Your code runs on an ASP.NET Core server during the publishing and pre-rendering, not on a Web browser. That means, if your code access any kind of web browser-specific objects or services at the "OnInitilized", such as invoking JavaScript, it crushes the pre-rendering process again. |
@jsakamoto This now worked for simple project. Howerver this fails in my production blazor project. Web.csproj:<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
<BlazorWasmPrerenderingRootComponentSelector>#body</BlazorWasmPrerenderingRootComponentSelector>
<!--<AnalysisMode>AllEnabledByDefault</AnalysisMode>-->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BlazorWasmPreRendering.Build" Version="1.0.0-preview.11.0" /> Program.cs:var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));
builder.RootComponents.Add<App>("#body");
builder.RootComponents.Add<HeadOutlet>("head::after");
ConfigureServices(builder.Services, builder.Configuration);
await builder.Build().RunAsync();
static void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{ Index.razor.cs:public class IndexBase : ComponentBase, IDisposable
{
private readonly CancellationTokenSource _cancellationTokenSource = new();
[Inject] private IDashboardDataService DashboardDataService { get; set; }
//protected override async Task OnInitializedAsync()
//{
// var result = await DashboardDataService._(_cancellationTokenSource.Token);
// await _();
//}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
var result = await DashboardDataService._(_cancellationTokenSource.Token);
await _();
await __();
}
} Error Logs:
Am I doing anything wrong here? |
@jsakamoto never mind. I figured out the build error issue. I apologise. I forgot to add
index.html<!DOCTYPE html>
<html class="h-full overflow-hidden">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!--<meta http-equiv="Content-Security-Policy"
content="base-uri 'self';
block-all-mixed-content;
img-src data: https:;
object-src 'self';
script-src 'self'
'sha256-v8v3RKRPmN4odZ1CWM5gw80QKPCCWMcpNeOmimNL2AA='
'unsafe-eval';
style-src 'self'
'unsafe-inline';
upgrade-insecure-requests;">-->
<title>Galla | The Shopkeeper App</title>
<base href="/" />
<link href="_content/BlazorDateRangePicker/daterangepicker.min.css" rel="stylesheet" />
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
<link href="css/site.min.css" rel="stylesheet" />
<link href="Web.styles.css" rel="stylesheet">
<link href="manifest.json" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
</head>
<body id="body" class="h-full overflow-hidden">
<section class="fixed inset-0 h-full w-full flex justify-center items-center bg-black opacity-75">
<p class="text-white text-2xl font-bold"><i class="fas fa-circle-notch animate-spin"></i> Loading...</p>
</section>
<div id="blazor-error-ui" class="bg-red text-white fixed bottom-0 w-full z-50 p-2" style="display: none;">
An unhandled error has occurred. Please click on
<a href="javascript: void(0)" class="inline-block underline hover\:text-white" onclick="location.reload()">Reload</a>
to proceed.
<button class="delete dismiss fixed right-5 bottom-2"></button>
</div>
<script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>
<script src="_framework/blazor.webassembly.js"></script>
<script src="js/Chart.js"></script>
<script src="js/print.js"></script>
<script src="js/pdf.js"></script>
<script src="_content/BlazorDateRangePicker/clickAndPositionHandler.js"></script>
<script src="js/blazorInterop.js"></script>
<script>navigator.serviceWorker.register('service-worker.js');</script>
</body>
</html>
Now please can you further assist me on this? |
@fingers10 I'm sorry I had mistaken too. (see also the commit message of: 105bc7c) I've never tried your scenario yet, but anyway please consider try to the latest version if you can. |
Sure I'll check and get back. |
@jsakamoto still the same. No prerendering content in |
Could you execute the
I'm guessing the error message If so, you should be able also to see the prerendering command line text in the build process output. Then please copy that prerendering command line text, paste it in the terminal console, append the "-k" switch, and press the Enter key. After doing that, please open the URL http://127.0.0.1:5050/ on your web browser. I appreciate it if you report the details of the errors. |
@jsakamoto Sorry for the delayed response. Here are the requested details. Error:
Stack Trace::
Error:
Stack Trace:
Prerendering-InternalServerError.zip I have attached the complete HTML file for your reference. |
@fingers10 Thank you for letting me know! I fixed this problem and published the new version. Would you try it out? Again, thank you for your contributions! 👍 |
@jsakamoto Sure I'll check and get back. I have one more question. This package supports PWA apps and also fixed integrity issues? |
Yes, this package has been supported PWA apps correctly since the v.1.0.0-preview.12.0. Of course, it has not been experienced a lot of real-world tests, but in my few cases, it looks to be working fine for PWA offline support. |
@jsakamoto This time I'm getting new error related to URI. Console output:
I'll develop a minimal repro sample and get back |
@jsakamoto , I figured out. If any page has link with url fragment, then prerendering of that page fails. <NavLink href="blogs/blazor-wasm-exception-handling-and-error-boundary#global-exception-handling" Match="NavLinkMatch.All">
Global Exception Handling
</NavLink> Parsing of URL with fragment fails? |
@fingers10 Thank you for a lot of reporting! I improved this package and released the new version. https://www.nuget.org/packages/BlazorWasmPreRendering.Build/1.0.0-preview.18.0
In this version, this package shows the response content string when the HTTP status code does not represent success. I expect that improvement will be helpful to investigate and resolve server errors during the pre-rendering process. And, this version has been supported the "BlazorWasmPrerenderingKeepServer" MSBuild property option. Usually, the pre-rendering server is stopped automatically after the fetching process is completed.
During the pre-rendering server is running, you can investigate the Blazor apps running on the pre-rendering server. Sorry to bother you, I appreciate it if you try the latest version of this package again. |
@jsakamoto, Prerendering and Publish is successful now.
Is this the expected behavior?
<!-- %%-PRERENDERING-HEADOUTLET-END-%% -->
<script src="data:text/javascript;base64,KGZ1bmN0aW9uKG4sdCxpKXtmb3IodmFyIGY9bi5jcmVhdGVOb2RlSXRlcmF0b3IobiwxMjgpLHIsZSx1O2YubmV4dE5vZGUoKTspaWYocj1mLnJlZmVyZW5jZU5vZGUsdC50ZXN0KHIudGV4dENvbnRlbnQudHJpbSgpKSl7d2hpbGUoaT1yLm5leHRTaWJsaW5nKWlmKGU9aS50ZXh0Q29udGVudC50cmltKCksaS5yZW1vdmUoKSx0LnRlc3QoZSkpYnJlYWs7ci5yZW1vdmUoKTticmVha311PUFycmF5LmZyb20obi5xdWVyeVNlbGVjdG9yQWxsKCJzY3JpcHQiKSkucG9wKCk7dSYmdS5yZW1vdmUoKX0pKGRvY3VtZW50LC9eJSUtUFJFUkVOREVSSU5HLUhFQURPVVRMRVQtKEJFR0lOfEVORCktJSUkLyk7"></script>
</head> Please can you explain on why this is getting added? My
Both the above urls get's saved inside
Please correct me if I'm wrong.
|
That is by design at this time. The prerendered contents can be visible immediately. Therefore, the "BlazorWasmPreRendering.Build" keeps the "Loading..." contents and makes the prerendered contents to be invisible for humans by CSS styling. That means only search engine crawlers can see the prerendered contents. However, if the developer knows these backgrounds, the developer does not need to take that strategy. For example, the "ClickOnce Get" site ( https://clickonceget.azurewebsites.net/ ) that is built on Blazor WebAssembly shows prerendered contents to users immediately, but the buttons are disabled by CSS styling until the Blazor WebAssembly engine has been started. If developers understand this technic and can implement that controlling user interaction, the "BlazorWasmPreRendering.Build" should replace all of the contents inside the #app element without keeping "Loading..." contents. Unfortunately, the "BlazorWasmPreRendering.Build" doesn't provide the option that replaces all of the contents inside of the #app element without keeping "Loading..." contents at this time. However, currently, I'm considering implementing that option. Appendix: |
@jsakamoto many thanks for your response. Please can you help me out with other queries in my previous comment? |
@jsakamoto, Many thanks. I'll try at the above response. In PWA apps, In general while publishing, if Here is my view. Please share your thoughts on this. when when This way crawlers will have correct snapshot of all the pages. And is there any other way we can avoid flickering effect when directly opening any routes other than |
To my knowledge, the updated The browser's "reload" button doesn't have any effect. I forget the source of that information, but I remember that I heard it is by the design of some web browser products. However, if you are developing that PWA, you can reload forcibly using the Chromium browser's developer tools with the following steps.
|
No, all pre-rendered output will be replaced "Loading..." text with respective page content even it is the root Particularly, the "Loading..." text of the root "index.html" file will be replaced with the result content of the request to the "/" URL path. |
The published results on usual Blazor WebAssembly apps with this NuGet package will behave without flickering, not as you reported. I came up with two reasons for those flickering behavior.
|
@jsakamoto, is it possible for you to let me know your availability for a scheduled call? |
First of all, basically, please remember that this package is my hobby project using my free time, so I can't spend much time. And, I'm a native Japanese speaker, not a native English speaker. And, I live in Japan, so the time zone for me is Japan Standard Time, JST, UTC+9:00. But I'm a little bit interested in your proposal even though some negative points are above. If you understand the above list well and still would like to make a scheduled call, would you like to send messages to me via the LinkedIn chatting window? Of course, I don't mind changing your mind to cancel making a scheduled call for the above reasons. |
@jsakamoto no worries. sorry to trouble you. we can connect once we get comfortable. till then lets discuss here. Coming to PWA reload. Do all the consumers of app needs to enable |
No, all the consumers of apps usually do not need to enable the On the default implementation of the Instead, once all browser processes are exited, or all browser's tabs navigated away from the app, the PWA app will be refreshed automatically next time access. The Microsoft Docs site at the following link must be helpful for you. Again, that behavior depends on the default implementation of the We should be able to control the cache behavior of PWA apps, such as choosing cache strategies, but I'm not familiar with it at this time. About this topic, to ask in the "Stack Overflow" site might be a better way than to discuss in this issue thread. |
Hi @jsakamoto Publish fails after upgrading I just updated all Nuget packages and Visual Studio to latest version. And on publish I get the following error.
|
@fingers10 Please attach the project that you could reproduce this problem. Thank you for your great cooperation! 👍 |
@jsakamoto I'm sorry. This looks like a dotnet sdk issue. There is an active issue in dotnet sdk repo for this. |
@jsakamoto , I would like to understand more on flickering effect that occurs when prerendered site is loaded. Please can you assist me on this. I have this repo - https://github.com/fingers10/WasmServerPrerender published to GitHub Pages using the below URL. Here is the sample URL that I'm using for testing - https://fingers10.github.io/WasmServerPrerender/fetchdata Steps I followed,
Here is the video showing the same. ScreenRecorderProject6.mp4Thank you for your support and teaching. |
@fingers10 Thank you for informing me about that behavior with the very understandable report! I immediately understood this problem due to your detailed description and a short video.👍 Anyway, as far as I can see, that behavior you reported is not an expected one for me. It looks very weird. Unfortunately, I don't have enough time to investigate this issue right now, but I'll do it later as soon as I have enough time. By the way, this issue #2 thread is unsuitable for discussing your reported issue. So I created new issue #17. |
Sorry, I've been trying to use Prerendering build again recently and have failed. This is my branch that has solved the problem you mentioned above. https://github.com/ant-design-blazor/ant-design-blazor/tree/chore/prerender-build |
@ElderJames Thank you for getting touch with me. |
@ElderJames I sent a pull request to make the "AntDesign.Docs.Wasm" be able to pre-render with the "BlazorWasmPreRendering.Build" NuGet package. |
@jsakamoto Thank you for your generous help! I'll keep working to get it deployed online. |
@jsakamoto whenever I publish and prerender and host in my local IIS, i get the following error
On clicking of any of the above error, it takes me to respective js files and shows I tried copy pasting the html to online html formatter but no errors or unexpected token. Please can you assist on this? |
Q1. Have you installed the |
|
Thank you for your reply. Even if the "PublishSPAforGitHubPages.Build" package worked unexpectedly, it is still very weird that So, please respond to the following request from me.
|
I published to default folder profile and copied the published contents to folder in C drive which is mapped to IIS virtual directory. I have attached the folder profile and publish contents. Publish Output is more than 25MB and GitHub is not allowing to upload. hence giving you an external link to download. - https://www.mediafire.com/file/23hkiafkfaermnc/Publish+Issue.zip/file |
@fingers10 Thank you for providing detailed information. So I could figure out what is the reason for this problem. Of couse, I'll fix the "PublishSPAforGitHubPages.Build" package. Please give me time for a while. Again, Thank you for providing specific and detailed information. 👍 |
@fingers10 Please upgrade to it and try that again. Aside However, I really appreciate you ❤️ because you always let me know if the packages I created seem to have a bug. Your activity must be helpful not only to me but also to all developers who use those my NuGet packages. So I'll thanks to you if you also understand how to treat GitHub issues! |
Many thanks for the fix. It's working now. I apologize for posting the issue here, I'll make sure I'll not repeat this next time. |
I'm happy for you that I heard about that from you! 😊 Again, many thanks to your contributions! 👍 |
The prerendering have been available on antblazor.com ! Thank you! |
Hi there, I tried to install this package to https://github.com/ant-design-blazor/ant-design-blazor, but an exception occurred during the publishing process.
The text was updated successfully, but these errors were encountered: