Repository: oppia/oppia

Issue:
Server error: Login url not found
This error occurred recently in production

```
Error: Login url not found.
at (https://www.oppia.org/build/templates/head/components/top_navigation_bar/TopNavigationBarDirective.4589537492f63e3b0ef9e1b656273ec6.js:1)
at (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:131)
at m.$eval (angular.min.js:145)
at m.$digest (angular.min.js:142)
at m.$apply (angular.min.js:146)
at l (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:97)
at J (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:102)
at XMLHttpRequest.t.onload (angular.min.js:103)

```

**General instructions**
There are no specific repro steps available for this bug report. The general procedure to fix server errors should be the following:

* Analyze the code in the file where the error occurred and come up with a hypothesis for the reason.
* Get the logic of the proposed fix validated by an Oppia team member (have this discussion on the issue thread).
* Make a PR that fixes the issue, then close the issue on merging the PR. (If the error reoccurs in production, the issue will be reopened for further investigation.)

Server error: Login url not found
This error occurred recently in production

```
Error: Login url not found.
at (https://www.oppia.org/build/templates/head/components/top_navigation_bar/TopNavigationBarDirective.4589537492f63e3b0ef9e1b656273ec6.js:1)
at (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:131)
at m.$eval (angular.min.js:145)
at m.$digest (angular.min.js:142)
at m.$apply (angular.min.js:146)
at l (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:97)
at J (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:102)
at XMLHttpRequest.t.onload (angular.min.js:103)

```

**General instructions**
There are no specific repro steps available for this bug report. The general procedure to fix server errors should be the following:

* Analyze the code in the file where the error occurred and come up with a hypothesis for the reason.
* Get the logic of the proposed fix validated by an Oppia team member (have this discussion on the issue thread).
* Make a PR that fixes the issue, then close the issue on merging the PR. (If the error reoccurs in production, the issue will be reopened for further investigation.)



Discussion:
/cc @vojtechjelinek 
Hi, A quick update...

I was able to repro this issue (on test server with oppia v2.8.3): 
1. Login.
2. Start playing an exploration from the library.
3. Press the back button on the browser.
4. You should be on the library page, but also the sign-in button is shown again.
5. Click on it, and check the console.

Not sure if this is repro able on the latest develop... Could someone confirm? Thanks!
Hi @nithusha21, I'm having trouble reproducing this on develop, but that might be perhaps because I don't understand step 1. 

Could you please clarify whether that step means "login" or "signup"? Also, what page should I be on just before this action, and after signup, am I redirected to a page like the creator/learner dashboard, and then I'm supposed to click on the Library from there?

Thanks!
Hi, 
So this issue would only occur in prod. In prod, the signup page in prod used the google sign-in (and not the dummy sign-in page we use in dev). So there is no intermediate view. So once you sign in, and click the back button, you go back to the page where you originally clicked sign-in, and it shows the sign-in button again. On clicking it, the error is raised. 
Just a heads-up that this is still occurring in production. /cc @kevintab95 

The log is not so useful though due to the webpack bundling. We might want to find a way to add traceback information. /cc @vojtechjelinek 

URL: https://www.oppia.org/collection/53gXGLIR044l

```
Error: Login url not found.
    at https://www.oppia.org/build/templates/head/dist/about~admin~collection_editor~collection_player~contact~creator_dashboard~donate~email_dashboard~ema~c7a97b2a.5b072c62932fc983a276.bundle.js:1:34157
    at https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:131:20
    at m.$eval (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:145:347)
    at m.$digest (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:142:420)
    at m.$apply (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:146:113)
    at l (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:97:322)
    at J (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:102:34)
    at XMLHttpRequest.t.onload (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:103:4)
```
This error occurred again on production.
Here is the latest stacktrace:
```
Cause: undefined Login url not found.
at Error (webpack:///core/templates/dev/head/components/common-layout-directives/navigation-bars/top-navigation-bar.directive.ts:103)
```

URL: https://www.oppia.org/splash
/cc @vojtechjelinek 
Hi, A quick update...

I was able to repro this issue (on test server with oppia v2.8.3): 
1. Login.
2. Start playing an exploration from the library.
3. Press the back button on the browser.
4. You should be on the library page, but also the sign-in button is shown again.
5. Click on it, and check the console.

Not sure if this is repro able on the latest develop... Could someone confirm? Thanks!
Hi @nithusha21, I'm having trouble reproducing this on develop, but that might be perhaps because I don't understand step 1. 

Could you please clarify whether that step means "login" or "signup"? Also, what page should I be on just before this action, and after signup, am I redirected to a page like the creator/learner dashboard, and then I'm supposed to click on the Library from there?

Thanks!
Hi, 
So this issue would only occur in prod. In prod, the signup page in prod used the google sign-in (and not the dummy sign-in page we use in dev). So there is no intermediate view. So once you sign in, and click the back button, you go back to the page where you originally clicked sign-in, and it shows the sign-in button again. On clicking it, the error is raised. 
Just a heads-up that this is still occurring in production. /cc @kevintab95 

The log is not so useful though due to the webpack bundling. We might want to find a way to add traceback information. /cc @vojtechjelinek 

URL: https://www.oppia.org/collection/53gXGLIR044l

```
Error: Login url not found.
    at https://www.oppia.org/build/templates/head/dist/about~admin~collection_editor~collection_player~contact~creator_dashboard~donate~email_dashboard~ema~c7a97b2a.5b072c62932fc983a276.bundle.js:1:34157
    at https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:131:20
    at m.$eval (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:145:347)
    at m.$digest (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:142:420)
    at m.$apply (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:146:113)
    at l (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:97:322)
    at J (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:102:34)
    at XMLHttpRequest.t.onload (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:103:4)
```
This error occurred again on production.
Here is the latest stacktrace:
```
Cause: undefined Login url not found.
at Error (webpack:///core/templates/dev/head/components/common-layout-directives/navigation-bars/top-navigation-bar.directive.ts:103)
```

URL: https://www.oppia.org/splash

Resolving patch:
diff --git a/core/controllers/profile.py b/core/controllers/profile.py
--- a/core/controllers/profile.py
+++ b/core/controllers/profile.py
@@ -412,6 +412,8 @@ class UserInfoHandler(base.BaseHandler):
     @acl_decorators.open_access
     def get(self):
         """Handles GET requests."""
+        # The following headers are added to prevent caching of this response.
+        self.response.cache_control.no_store = True
         if self.username:
             user_actions = user_services.UserActionsInfo(self.user_id).actions
             user_settings = user_services.get_user_settings(


Test patch: