Firebase deploy - Not loading new page - firebase

I am deploying a PWA to firebase using the tutorial from the polymer project website. I have no issues deploying to firebase, but if I deploy a second time the new page does not load. It will load the old page until I clear the cookies. I see understand that the way a PWA site works is like an application where it stores parts in memory for faster load times. Is there a setting I need to change to make it load most recently deployed webpage? I appreciate all the help, thanks in advance!

You might be seeing an effect of your service worker. Try deleting the currently registered service worker from your browser so that the new one can take over.
In Chrome 51/52, open DevTools while on your site, and go to the Resources tab, and then Service Workers on the left panel. Click Delete to remove the service worker. You could also check the box for Update on reload, which allows you to update the service worker simply by refreshing the page.

Related

PWA with Windows Authentication

On the high level, I have a PWA with React frontend and .netcore backend. I use service worker for caching and offline ability, in conjunction with workbox plugins for some precaching feature.
The app uses Windows Authentication. Which works fine if it wasn't a PWA app. It also works fine the first time the PWA app launches, I get the username, password login popup.
However from the second time visiting the app, it wouldn't show the login popup, the app fails at pulling data from the backend because it is unauthenticated. One weird behavior is that, if I open Chrome Dev Tools(by F12), then the login popup immediately shows up.
I thought it's caching related and somehow the service worker interfered with the server side authentication workflow. Maybe because the index page is cached by the workbox precache plugins, and it did not cache with the fetch header of 'credentials': 'include'? I tried adding the fetch option to other api routes, which are cached by workbox plugin RegisterRoute. However I didn't find a way to add it to the precacheAndRoute(self.__WB__MANIFEST). Wondering if that's the problem. But I'm also not sure why having Dev Tools open would trigger the popup to display.
Any input is appreciated.

After deploy to firebase, changes in browser will not update without deleting site cache in browser

Instead of asking all users to delete their cache when an update is pushed, is there a script I can add to my app so that when the site is loaded it deletes the existing cache for the site?
I could remove the script when the app is complete but for development and testing purposes I deploy (or serve locally) multiple times a day, its a pain to have to delete my cache every time.
An even bigger pain is trying to get others to delete cache when I tell them the site has been updated and I need feedback.
Thanks
EDIT: After much searching I think this How to remove a service worker registered in previous deploy from users' browsers with the newly deployed version of site (Firebase)? is similar to what the problem is, but the answers are not specific. It looks like the issue might be with a service worker but I am unsure how to implement a fix.

How to track intermittent issue with loading/non loading of web site in ASP.NET MVC 5

I am beginner in web development. And I am working in an ASP.Net MVC 5 application and stuck with a very weird issue.
Issue:
Sometimes my web site just won't load in the browser. When I run in the local dev machine, website loads properly (localhost). But in LIVE the browser will keep on loading the website but nothing would load.
Also
After half an hour or so, website again kicks back in and starts opening properly.
Action I took:
Sometimes restarting the WebSite from IIS fixes the issue, BUT NOT ALL THE TIME. Sometimes even restarting did not fix the issue.
Also, I checked the Chrome Debugger, I do not see any error there (when the website was not loading).
I know something called ELMAH exists. Or some error logging in IIS. Can some one tell me how can I track this issue, in step by step process. Why my website will keep on trying to load in browser but will never load But after some time it loads. Is it IIS issue?
KINDLY NOTE: Once it starts loding fine, then even if I close the website and reopens it, It opens superfast like a flash. So the hiccups comes sometimes only.
I am willing to put more details, in this question. but I am not sure what to put. as far as IIS is concerned, all I know is how to restart and stop my website. that's it.
EDIT
Step 1: So, I searched event viewer as a whole in windows search and found something like below.
Edit 3
I checked the windows log, I do not see any issue related to my web app.
I know something called ELMAH exists.
Elmah is alogging framework. With just installing the NuGet package you already have an effective error logging mechanism in place. All unhandled exceptions will be logged with all the related information. It provides a page to visualize your logs and you can configure almost everything from security, to different back-end storages.
If you need a cloud base error logger with more advanced features you can use elmah.io.
Take a look at this post for a step by step guide on how to integrate elmah.

ASP.Net redirecting to local host after authentication

I just created a webform that is hosted in my Azure subscription. I set it up with authenication via my works Azure directory for authenticating users. In debug this works fine and I am able to login with my work credentials and then view the website via local host.
I have published this to my Azure and it says it is running and working fine. So when I try to connect to the website it continuously redirects me to the localhost resulting in an error.
I have checked the web config.
Here is the google network chain of events when it occurs.
I am really lost as to what is wrong and what I need to do to fix this so any help would be greatly appreciated. I'm sorry I can't offer more but I don't even know what is wrong to begin with or where to look. Is there some setting in Azure that I need to add the website too?
I have solved this issue. Since it was such a pain I will keep this up as I couldn't find any answers on this. It was actually quite simple.
You have two options. The one I did and which worked was changing the publish profile as below:
Add the domain where the authentication is occurring. So if you have your web app hosted by a different azure account that which is authenticating the users, use the one that is authenticating.
This will create two versions of your app on the site one for local host and one for the actual site.
The second option(I have not tried this but it should work) is to go to the Azure account where you are authenticating the users and go to applications and then configure. Change the APP URL from local host to the url you are trying to get to.
Here is an excellent link that explains how to do this clearly.
Click this link for detailed explanation
I also had this issue and took these steps to resolve
navigate to the app registration in AAD
Open the manifest
Change the ReplyUrl to the url of the app (e.g. http://appname.azurewebsites.net)
Then I got the error
Bad Request - Request Too Long HTTP Error 400. The size of the request headers is too long.
Next I cleared all cookies from the browser, and this changed the error to just
Bad Request
So I went back to that ReplyUrl and changed it to https://appname.azurewebsites.net/.auth/login/aad/callback and now it appears to work.
Note I also had to make sure I didn't have the site open in any other tabs before it started working
I had this issue when I switched an app from our company Azure over to a customer's Azure. In my case I'd forgotten to update the ida:ClientId, ida:AADInstance and ida:TenantId, which then meant that the value I'd set for ida:PostLogoutRedirectUri was ignored (I think) and instead my app redirected to localhost.
Once I changed those ida values to the values from the app settings and subscriptions settings on our customer's Azure it all worked as expected.
It took a while to track down all the values in Azure portal as they are all called something different, or aren't named at all:
ClientId can be found at Azure Active Directory > App Registrations > YourAppName. It's called 'Application ID' in Azure
Domain can be found on Azure Active Directory > Overview. It's currently in the top left in the format somename.onmicrosoft.com
TenantId this is the Azure AD instance ID, get that from Azure Active Directory > Properties and then it's called 'Directory ID'
I spent a lot of time trying to work out where the localhost port that was being redirected to was in the code, but it simply isn't there as far as I can see, so I have no idea how Azure was choosing what localhost address to redirect to!
You need to set another parameter in configuration that is replyUrl and assign to your web app, other wise it takes the url from which it was originated.
I was able to fix this by changing my Startup.Auth.cs file redirectUri from "https://localhost:44316/" to https://myapp.com/

updating Silverlight application # website

I have the following scenario: a Silverlight application (constructed to be OOB) embedded at an ASP.NET website where, if the user already installed it, a label saying that is displayed; otherwise, an install button appears. Eventually I can update the .xap file available in the website.
Now the problem: if the user executes the application through his Desktop/Start Menu, i'm able to update the application and suggest the user to restart it. But, if I update the .xap file and upload it again to the website, apparently no "Silverlight update" occurs, it is displayed as a new application (if the user install it again, an application icon is displayed at his desktop).
Is there something I'm missing or there's nothing to do about this?
Thanks!
Signing the Silverlight application solves the problem.
When you run in a browser, updates are picked up right away (subject to HTTP caching rules). With OOB apps you need to use the App.Current.CheckAndDownloadUpdateAsync() method in your app to have it update.
http://msdn.microsoft.com/en-us/library/system.windows.application.checkanddownloadupdateasync(v=vs.95).aspx
The only drawback is that there is no way to just check for an update and give the users an option to download it conditionally; calling this always updates it if there is an update. You can however hook into the event and find info about the update should you wish. See this resource for more information: http://forums.silverlight.net/forums/p/180931/408554.aspx

Resources