Repository: oppia/oppia

Issue:
404 When Retrieving third_party.js When Creating User in Prod Mode
<!--
  - Thanks for taking the time to report a bug in the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
 1. Run server in prod mode with `python -m scripts.start --prod_env`
 2. Click on `Sign In` in the menu bar
 3. Leave `test@example.com` as the email
 4. Click `Login`
 5. Let `http://localhost:8181/signup?return_url=%2F`, where the user normally agrees to the terms of service and enters a username, load

**Observed behavior**
The page does not load, and the following appears in the server's console output:

```
...
INFO     2019-09-20 04:46:34,396 module.py:835] default: "GET /third_party/generated/css/third_party.css HTTP/1.1" 404 -
INFO     2019-09-20 04:46:34,465 module.py:835] default: "GET /templates/dev/head/css/oppia.css HTTP/1.1" 304 -
INFO     2019-09-20 04:46:34,606 module.py:835] default: "GET /webpack_bundles/signup.bundle.js HTTP/1.1" 304 -
INFO     2019-09-20 04:46:34,652 module.py:835] default: "GET /webpack_bundles/about%7Eadmin%7Eclassroom%7Ecollection_editor%7Ecollection_player%7Ecommunity_dashboard%7Econsole_errors%7Econtact%7Ee78591d4.bundle.js HTTP/1.1" 304 -
INFO     2019-09-20 04:46:34,746 module.py:835] default: "GET /webpack_bundles/runtime.bundle.js HTTP/1.1" 304 -
INFO     2019-09-20 04:46:35,703 module.py:835] default: "GET /webpack_bundles/vendors%7Eabout%7Eadmin%7Eclassroom%7Ecollection_editor%7Ecollection_player%7Ecommunity_dashboard%7Econsole_errors%7E561518cc.bundle.js HTTP/1.1" 304 -
INFO     2019-09-20 04:46:36,339 module.py:835] default: "GET /third_party/generated/js/third_party.js HTTP/1.1" 404 -
```

**Expected behavior**
The page should load without errors.

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS
 - Browser: Firefox
 - Version: 1c46cbd67d4da49023d22055db4f61be85e6fa1d

**Additional context**

Based on the server output to the console, this appears to be because of a 404 when retrieving `third_party/generated/js/third_party.js`. The file that exists (and that I think should be the target) is `third_party/generated/js/third_party.min.js`. This occurs even after making a fresh clone of the `oppia/oppia` repository.

/cc @kevinlee12 @oppia/dev-workflow-team

This is blocking my development.

404 When Retrieving third_party.js When Creating User in Prod Mode
<!--
  - Thanks for taking the time to report a bug in the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
 1. Run server in prod mode with `python -m scripts.start --prod_env`
 2. Click on `Sign In` in the menu bar
 3. Leave `test@example.com` as the email
 4. Click `Login`
 5. Let `http://localhost:8181/signup?return_url=%2F`, where the user normally agrees to the terms of service and enters a username, load

**Observed behavior**
The page does not load, and the following appears in the server's console output:

```
...
INFO     2019-09-20 04:46:34,396 module.py:835] default: "GET /third_party/generated/css/third_party.css HTTP/1.1" 404 -
INFO     2019-09-20 04:46:34,465 module.py:835] default: "GET /templates/dev/head/css/oppia.css HTTP/1.1" 304 -
INFO     2019-09-20 04:46:34,606 module.py:835] default: "GET /webpack_bundles/signup.bundle.js HTTP/1.1" 304 -
INFO     2019-09-20 04:46:34,652 module.py:835] default: "GET /webpack_bundles/about%7Eadmin%7Eclassroom%7Ecollection_editor%7Ecollection_player%7Ecommunity_dashboard%7Econsole_errors%7Econtact%7Ee78591d4.bundle.js HTTP/1.1" 304 -
INFO     2019-09-20 04:46:34,746 module.py:835] default: "GET /webpack_bundles/runtime.bundle.js HTTP/1.1" 304 -
INFO     2019-09-20 04:46:35,703 module.py:835] default: "GET /webpack_bundles/vendors%7Eabout%7Eadmin%7Eclassroom%7Ecollection_editor%7Ecollection_player%7Ecommunity_dashboard%7Econsole_errors%7E561518cc.bundle.js HTTP/1.1" 304 -
INFO     2019-09-20 04:46:36,339 module.py:835] default: "GET /third_party/generated/js/third_party.js HTTP/1.1" 404 -
```

**Expected behavior**
The page should load without errors.

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS
 - Browser: Firefox
 - Version: 1c46cbd67d4da49023d22055db4f61be85e6fa1d

**Additional context**

Based on the server output to the console, this appears to be because of a 404 when retrieving `third_party/generated/js/third_party.js`. The file that exists (and that I think should be the target) is `third_party/generated/js/third_party.min.js`. This occurs even after making a fresh clone of the `oppia/oppia` repository.

/cc @kevinlee12 @oppia/dev-workflow-team

This is blocking my development.



Discussion:

Resolving patch:
diff --git a/scripts/start.py b/scripts/start.py
--- a/scripts/start.py
+++ b/scripts/start.py
@@ -94,25 +94,25 @@ def main(args=None):
         '--enable_console=true' if parsed_args.enable_console else '')
 
     if parsed_args.prod_env:
-        constants_env_variable = '\'DEV_MODE\': false'
+        constants_env_variable = '"DEV_MODE": false'
         for line in fileinput.input(
                 files=[os.path.join('assets', 'constants.ts')], inplace=True):
             # Inside this loop the STDOUT will be redirected to the file,
             # constants.ts. The end='' is needed to avoid double line breaks.
             python_utils.PRINT(
                 re.sub(
-                    r'\'DEV_MODE\': .*', constants_env_variable, line), end='')
+                    r'"DEV_MODE": .*', constants_env_variable, line), end='')
         build.main(args=['--prod_env', '--enable_watcher'])
         app_yaml_filepath = 'app.yaml'
     else:
-        constants_env_variable = '\'DEV_MODE\': true'
+        constants_env_variable = '"DEV_MODE": true'
         for line in fileinput.input(
                 files=[os.path.join('assets', 'constants.ts')], inplace=True):
             # Inside this loop the STDOUT will be redirected to the file,
             # constants.ts. The end='' is needed to avoid double line breaks.
             python_utils.PRINT(
                 re.sub(
-                    r'\'DEV_MODE\': .*', constants_env_variable, line), end='')
+                    r'"DEV_MODE": .*', constants_env_variable, line), end='')
         build.main(args=['--enable_watcher'])
         app_yaml_filepath = 'app_dev.yaml'
 


Test patch: