Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
327 stars 56 forks source link

SWA auth middleware randomly crash #1061

Open remirobichet opened 1 year ago

remirobichet commented 1 year ago

I encounter a big issue right now. I have 4 static web apps deployed on azure (Central France datacenter) and they all break at the same time. More specifically the Auth middleware from the static web app seems to be broken for ~3min every 10min. During this downtime, all auth routes (eg: <host>/.auth/*) are not redirecting following staticwebapp.config.json configuration. As result, all these routes are handled by my Nuxt.js app and fallback to a 404 error.

Additionnal informations:

RyanMatCook commented 1 year ago

Also having a problem and can't figure it out. It comes and goes so can't find a root cause.

No changes to the auth flows and users have been experiencing issues since basically the Azure outage.

When in my live SWA, users seem to get stuck in a redirect loop between /.auth/me and app root. The error I get is "Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON" which I can see in the console.

When I run a JS function to get /.auth/me from the console, it returns the app root page as html markup, whereas on my local it returns the usual JSON I'd expect to see with user roles etc.

PS, I was viewing a Power BI report now and saw the same thing coming up in the console as a warning so maybe this issue is related to Azure AD rather?

remirobichet commented 1 year ago

I've made further investigation, but I still don't have any answer.

Here is my use case : I've created 2 new SWA, one located in "westeurope" and one in "centralus". Then I deployed the exact same application on both using SWA cli. They are all good, without any issue.

My 4 others SWA are still broken... They are deployed from azure pipeline, this is the only difference.

danbasszeti commented 1 year ago

I have the same issue. Opened a ticket with Microsoft and not had much back after sending them two Fiddler traces.

This is critical for us, it's blocking all of my apps in production and there's nothing I can do about it. At the moment we seem to be able to get people online if they choose another browser - but I'm not convinced that its anything beyond just having a fresh cache.

@anthonychu this is really a big problem for us right now!

admin-vzd commented 1 year ago

I also have the same issue and also opened a ticket.

This is blocking two of my production apps since both have restricted access to the entire application... so no auth, no app access.

roboalbers commented 1 year ago

I also have the same issue and also opened a ticket.

This is blocking two of my production apps since both have restricted access to the entire application... so no auth, no app access.

Experiencing exactly the same. Entire application behind auth. Stuck in a redirection loop from Azure AD, at some times, you are enable to login, otherwise an infinite loop trying to redirect the user back and forth from the login point. Issues started around 25/1.

admin-vzd commented 1 year ago

@roboalbers I bet if you go to “Diagnose and solve problems” under the swa settings in Azure your auth config will be null as reported in #1038

johnnyreilly commented 1 year ago

I too have this issue; seems to have been happening since around 25/01/2023 - in case it's significant, we're deployed to West Europe.

roboalbers commented 1 year ago

@admin-vzd Actually not, I can see the auth config. Been told by the support to add "responseOverrides": { "401": { "statusCode": 302, "redirect": "/.auth/login/aad?post_login_redirect_uri=.referrer" } }, But doesn't change anything regarding my infinite loop from aad, where I before didnt have the post_login_redirect_uri.

Update: I've also got confirmation from Microsoft support that the issue is on their side.

nrandell commented 1 year ago

I've got exactly the same - they have said it's a known issue and the product group are working on it! It's taken them 3 days to get round to telling me this! Not impressed

danbasszeti commented 1 year ago

Currently having to prep backup plans, none of which are nice really, and most likely end up with us having to host everything either on an App Service or a Container (presuming that AAD B2C itself isn't broken as this appears to be a static web apps issue given the others here who are using various 3rd party auth providers)

nrandell commented 1 year ago

I've just tried a brand new deployment on a totally separate site - exactly the same issue! Looks like it's something core to static web apps. Tried both in Europe and the US - same issue!

@anthonychu - is there any ETA for this. I need something to tell our customer.

sgollapudi77 commented 1 year ago

I've got exactly the same - they have said it's a known issue and the product group are working on it! It's taken them 3 days to get round to telling me this! Not impressed

Hi @nrandell we're working on this, and we'll let you know once we get more details on this.

sgollapudi77 commented 1 year ago

Hey everyone, `Azure Static Web Apps in West Europe users might have experienced failures with login access. We have identified that there was a misconfiguration on a local node affecting a node which had caused login requests to be left in a suspended state.

Mitigation: We made a networking change to a unhealthy node to bring back the node to a healthy state.

Next steps: We will continue to investigate to establish the full root cause and prevent future occurrences.`

nrandell commented 1 year ago

This is looking a lot better for us! as you can see. Thank you.

image
Bionic711 commented 1 year ago

I have been having the same issues and paid the $29 for developer support but it has not gone anywhere yet. My dev site is working as expected but my production site does not allow any of the authentication pages to log in users.

nrandell commented 1 year ago

I have been having the same issues and paid the $29 for developer support but it has not gone anywhere yet. My dev site is working as expected but my production site does not allow any of the authentication pages to log in users.

Sounds like it may be another problem. Make sure support are aware of this github issue as well. As far as I can see, our site has been working perfectly for the last 4 days.

johnnyreilly commented 1 year ago

Is this issue re-occurring? I'm experiencing issues. See also https://github.com/Azure/static-web-apps/issues/1076

jonnekleijer commented 10 months ago

Not sure if this is related, but since a recent release of our app b2c keeps redirecting? I opened a seperate ticket.

image

StanSymphonia commented 6 months ago

We're experiencing the original issue since yesterday (swa hosted in West Europe).

Any info or news would be greatly appreciated.

TonyLunt commented 6 months ago

We are also experiencing this intermittently in the East US 2 region.

johhau commented 6 months ago

Same issue here since late last week. SWA hosted in West Europe.