aws / aws-lambda-dotnet

Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Apache License 2.0
1.55k stars 479 forks source link

Allow "Blazor Web App" to run in Interactive Render Mode Webassembly in Lambda #1753

Open genifycom opened 2 months ago

genifycom commented 2 months ago

Describe the feature

In .Net 8 if you create a "Blazor Web App" with Interactive Render Mode WebAssembly you will get two projects. The Server side rendered project (SSR) and the client WebAssembly project (CSR).

If you convert this to a Lambda Application, then it runs correctly locally. When deployed to Lambda, the SSR part works correctly (as it is all generated on the server) but the Client Webassembly part does not (CSR).

This is because the Client tries to download the WASM files and runs into an issue.

In Chrome Dev tools -> Network -> WASM

It downloads 27 wasm files correctly but when it gets to dotnet.native.wasm it fails with a 500 error.

This file is in the wwwroot/_framework directory and dotnet.native.wasm is 2.78 MB (2,917,966 bytes) in size.

I supposed it is possible that this WASM file when converted to base64 exceeds what lambda can supply in a payload.

But after this 500 error, the rest of the WASM files do not download so the client web assembly application fails.

This is hugely disappointing since this only allows Blazor Web App SSR to run in lambda which is very limiting.

Use Case

Want the lambda function to use both SSR and CSR pages so that Webassembly can be leveraged from Lambda.

Proposed Solution

Increase the lambda payload to allow Blazor CSR rendering to run correctly.

Other Information

NOTE: This is not using Blazor Server at all. Only Server side rendering and Webassembly rendering. There are no web sockets involved at all.

Acknowledgements

AWS .NET SDK and/or Package version used

All most recent non-preview version.

Targeted .NET Platform

NET 8

Operating System and version

Windows 11

genifycom commented 1 month ago

Do you need any further information on this item?

genifycom commented 2 weeks ago

This really is a huge problem for us.

Blazor CSR can only be deployed in an S3 bucket which means we do not have the control over it like a Lambda process. Blazor SSR Interactive is a non-starter because we cannot supply a websocket from the lambda function (and do not want to). Blazor SSR is limited because we still need client side items for any interactivity.

AWS Lambda has been the most successful deployment strategy and we really do not want to have to give it up!

genifycom commented 1 day ago

Any further questions?