-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
net7 Blazor WASM AAD authentication ends with There was an error trying to log you in: '"undefined" is not valid JSON' #44981
Comments
@MackinnonBuck I believe you may've had a patch in the trimming/auth space recently. Is this potentially a dup? |
If you don't need the TrimmerRootDescriptor XML for anything else already, a faster workaround is to just add
in your csproj file |
@TanayParikh This seems different from the trimming error we saw before. The same issue was described in this comment. I'd say this is a real thing and possibly a servicing candidate. |
Exact same issue for me. Please fix this ASAP |
@hakenr disabling the trimming for the assembly is the current workaround |
In a hosted Blazor: is that for the server or the client project or for both? I added it to the server project (which I deploy) but that did not work. |
@hjrb In both cases (asp.net core hosted or not) you have to add the TrimmerRootDescriptor or TrimmerRootAssembly tags in the Blazor (client) csproj file |
Added the |
@rena0157 That seems odd, publishing time didn't seem to change for me at all. Are you using AOT? |
I am not no, but I do have another
Do you think having both could cause a performance issue? I had the previous one due to a previous trimming issue with auth. Going to remove the first one and see if there is a difference in perf. |
Hm, interesting. It might be. The good news is that you don't need the Microsoft.Authentication.WebAssembly.Msal included anymore. That issue is actually fixed in the net7 release. (See #33312) |
Ahh sweet thanks for the tip! I will remove that now and run some tests. Actually it seems that the publishing time for me about doubled when upgrading to .NET 7 in general. Notwithstanding the |
That's true, I noticed a generally longer publishing time as well |
I have a similar problem. My csproj file has the following.
I test it out and respond with my results when I deploy to a testing environment. |
So it looks like adding the following in my client .csproj file worked for me
It was mentioned that by @andref15 that we could remove the following line because it has been addressed in .net 7 release. I will comment to confirm. |
Exact same issue for me. Please fix this ASAP. Thank you @hakenr |
seeing this same issue on a production application upgraded straight from .net 5 to 7. These are the contents of the package references in the Client project:
|
When I did this it breaks my app all together. When its deployed with https I get an error like this: Failed to find a valid digest in the 'integrity' attribute for resource 'https://app.local:8443/_framework/Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll' with computed SHA-256 integrity 'vMnCiawojCEc5uD+LGveolw4GA8hQffXzamBOAdGDzw='. The resource has been blocked. |
Clean your bin and obj folders and publish again |
Adding to this, @JasonRodman if you are getting integrity issues in a deployment and are deployed on a CDN I have found that you need to purge the cache in order to fix this issue. |
That worked for me. It now publishes and runs without the error. |
So just to get this straight: Prior to .NET 7, we needed:
Then .NET 7 fixed this, but broke something else, and instead of the above, we now need:
And when changing these entries, we need to make sure to clean obj/bin folders or we get an unclean build with integrity errors. |
For anyone interested, the difference between trimming or not trimming the assembly is 74kB vs 83kB uncompressed (25kB vs 28kB with Brotli). I don't think it's a huge overhead. I guess either the "Models" or the "Options" folder contains the culprit(s), but didn't go through them one by one to see which needed to be rooted specifically. As they're not in a specific namespace, it's not easy to target them using linker XML either unless you specify them one by one. |
If my memory serves me correctly the whole reason we had to add the assembly trimming in the first place was to fix another bug during deployment discussed #33312 here. Is this no longer even necessary? It says its fixed but I never tried removing it and deploying it. Now I will have to remove all of it and see if it just works. |
@JasonRodman To me, the problem with the (Btw, I suspect the particular model object that is most suspect is |
We're having this problem too. For us, everything works fine on our laptops, but fails as soon as we deploy it to Azure. We're serving the app from a CDN. When we added this to our csproj, the problem goes away:
|
Got it working but, had to add the nuget package
|
this was addressed in 7.0.1 as part of #45028 |
Is there an existing issue for this?
Describe the bug
Sample project: https://github.com/havit/Bonusario
When upgraded from net6 to net7 the application started to fail with
right after logging in to Azure AD (end of auth workflow).
Applies only for published version, does not occur in development.
After several attempts I found that disabling assembly trimming for
Microsoft.AspNetCore.Components.WebAssembly.Authentication
resolves the issue.Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
7.0.100
Anything else?
Workaround
Add
to your
TrimmerRootDescriptor.xml
.See https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options
The text was updated successfully, but these errors were encountered: