Repository: oppia/oppia

Issue:
Console Error when Playing Story: Every parameter passed into interpolateUrl must have string values, but received: {entity_id: undefined}
<!--
  - 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**
Console error: `Every parameter passed into interpolateUrl must have string values, but received: {entity_id: undefined}`

**To Reproduce**
Steps to reproduce the behavior (from CUJ 31):

1. Login to Oppia. (as admin, if locally).
2. (if done locally) Assign yourself the admin role on the admin page.
3. Select the topics and skills dashboard button.
4. Create 2 skills, with one question for each.
5. Create a topic and assign these skills to the topic.
6. Create a story and add at least 3 chapters to it.
7. Create explorations with the same categories and add it to these chapters.
8. Add one of the skills as a prerequisite for the first chapter and the other as an acquired skill for the last chapter
9. Save and publish the story.
10. Navigate to the topic page (using preview button in the topic editor or going to the URL directly (/topic/<topicName>))
11. Then, click to launch the story from the Lessons tab

**Observed behavior**
A console error: `Every parameter passed into interpolateUrl must have string values, but received: {entity_id: undefined}`

**Expected behavior**
No error

**Screenshots**

![Screen Shot 2020-08-12 at 21 11 18](https://user-images.githubusercontent.com/19878639/90083524-c7bc1a80-dce0-11ea-83d2-bb6421ae11ea.png)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS
 - Browser: Firefox 79 and Chrome 84

Full error:

```
Unhandled Promise rejection: Every parameter passed into interpolateUrl must have string values, but received: {entity_id: undefined} ; Zone: <root> ; Task: Promise.then ; Value: Error: Every parameter passed into interpolateUrl must have string values, but received: {entity_id: undefined}
    fatalWarning alerts.service.ts:83
    interpolateUrl url-interpolation.service.ts:147
    C assets-backend-api.service.ts:227
    getThumbnailUrlForPreview assets-backend-api.service.ts:316
    generatePathIconParameters story-viewer-page.directive.ts:76
    onInit story-viewer-page.directive.ts:152
    invoke zone.js:386
    run zone.js:143
    E zone.js:891
    invokeTask zone.js:421
    runTask zone.js:188
    g zone.js:601
    invokeTask zone.js:507
    f zone.js:1671
    d zone.js:1708
 s</e.prototype.fatalWarning@https://oppiatestserver.appspot.com/build/webpack_bundles/about~admin~classroom~collection_editor~collection_player~console_errors~contact~delete_account~dona~bfc7b796.6a1186f433cd1e7d634b.bundle.js:1:6628
f</e.prototype.interpolateUrl@https://oppiatestserver.appspot.com/build/webpack_bundles/about~admin~classroom~collection_editor~collection_player~console_errors~contact~delete_account~dona~bfc7b796.6a1186f433cd1e7d634b.bundle.js:1:2340
C@https://oppiatestserver.appspot.com/build/webpack_bundles/about~admin~classroom~collection_editor~collection_player~console_errors~contact~delete_account~dona~bfc7b796.6a1186f433cd1e7d634b.bundle.js:1:140701
getThumbnailUrlForPreview@https://oppiatestserver.appspot.com/build/webpack_bundles/about~admin~classroom~collection_editor~collection_player~console_errors~contact~delete_account~dona~bfc7b796.6a1186f433cd1e7d634b.bundle.js:1:142641
1984/</<.controller</u.generatePathIconParameters@https://oppiatestserver.appspot.com/build/webpack_bundles/story_viewer.681767e1953bdf5ce7df.bundle.js:1:14223
1984/</<.controller</u.$onInit/<@https://oppiatestserver.appspot.com/build/webpack_bundles/story_viewer.681767e1953bdf5ce7df.bundle.js:1:15581
i/</l</e.prototype.invoke@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2127:7175
i/</s</t.prototype.run@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2127:2271
E/<@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2135:2717
i/</l</e.prototype.invokeTask@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2127:7859
i/</s</t.prototype.runTask@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2127:2934
g@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2127:10199
i/</p</t.invokeTask@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2127:9044
f@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2158:733
d@https://oppiatestserver.appspot.com/build/webpack_bundles/vendors~about~admin~classroom~collection_editor~collection_player~console_errors~contact~contributor~0f69d550.8083da074e4ea0442390.bundle.js:2158:1052
zone.js:690:28
```


Discussion:
I also got this error while testing it on chrome (version 84) on my mac (Catalina 10.15.6).
@Showtim3 could you make sure this blocking bug gets fixed?
@U8NWXD Can you check if the story being viewed has a valid thumbnail defined (and that the chapters also have thumbnails)?
This is a learner view bug. @aks681 @kevintab95 I'll handle the editor ones.

Resolving patch:
diff --git a/core/controllers/story_viewer.py b/core/controllers/story_viewer.py
--- a/core/controllers/story_viewer.py
+++ b/core/controllers/story_viewer.py
@@ -80,6 +80,7 @@ def get(self, story_id):
             node['exp_summary_dict'] = exp_summary_dicts[ind]
 
         self.values.update({
+            'story_id': story.id,
             'story_title': story.title,
             'story_description': story.description,
             'story_nodes': ordered_node_dicts,


Test patch:
diff --git a/core/controllers/story_viewer_test.py b/core/controllers/story_viewer_test.py
--- a/core/controllers/story_viewer_test.py
+++ b/core/controllers/story_viewer_test.py
@@ -222,6 +222,7 @@ def test_get(self):
                 '%s/staging/topic/%s'
                 % (feconf.STORY_DATA_HANDLER, self.STORY_URL_FRAGMENT))
             expected_dict = {
+                'story_id': self.STORY_ID,
                 'story_title': 'Title',
                 'story_description': 'Description',
                 'story_nodes': [self.node_2, self.node_1, self.node_3],