Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server error: Parameters passed into interpolateUrl must be strings #6158

Closed
nithusha21 opened this issue Jan 25, 2019 · 15 comments · Fixed by #7738 or #7952
Closed

Server error: Parameters passed into interpolateUrl must be strings #6158

nithusha21 opened this issue Jan 25, 2019 · 15 comments · Fixed by #7738 or #7952

Comments

@nithusha21
Copy link
Contributor

This error was seen on the production server. It was first reported recently, and might be due to some code change to these files that was done recently.

Error: Parameters passed into interpolateUrl must be strings.
at fatalWarning (https://www.oppia.org/build/templates/head/services/AlertsService.b387776b8e098c35abf20d2cc7bf0677.js:1)
at interpolateUrl (https://www.oppia.org/build/templates/head/domain/utilities/UrlInterpolationService.70d1b05806176ddd5621ee026b8234e5.js:1)
at k (https://www.oppia.org/build/templates/head/pages/exploration_player/StatsReportingService.7f5afa56d037b27925496d6622dac3bf.js:1)
at z (https://www.oppia.org/build/templates/head/pages/exploration_player/StatsReportingService.7f5afa56d037b27925496d6622dac3bf.js:1)
@import-keshav
Copy link
Contributor

import-keshav commented Feb 6, 2019

Hello @nithusha21 @DubeySandeep,
I go through the issue, and I found that there is a function in a file templates/head/pages/exploration_player/StatsReportingService.js
which returns the stats of a user whenever a learner tries to leave an exploration, when a learner starts an exploration, when a learner completes an exploration and also every five minutes.
imageedit_6_5941988196

I was confusing that did function call after every 5 minutes (when user login) or call after every 5 minutes (when the user starts an exploration ) ?

And if it calls after every 5 minutes when user login then this will always occur because this function calls
UrlInterpolationService service function interpolateUrl which expects a string but it was giving null until a user starts any exploration.
Or you can say that there is an exploration_id that always pass to interpolateUrl function but if a user does not start any exploration then exploration_id will be null and this is expected to come.
Thanks

@DubeySandeep
Copy link
Member

@import-keshav, Thanks for looking into it,

if it calls after every 5 minutes when user login then this will always occur because this function calls
UrlInterpolationService service function interpolateUrl which expects a string but it was giving null until a user starts any exploration.

StatsReportingService gets initialized only when users start playing exploration (over here). Once a user leaves an exploration the tab gets refreshed and the $interval function gets cleared. Also, this $ interval doesn't get called in the preview mode.

I would suggest you to try reproducing this locally (If you think this issue caused by whatever you have said above) and add steps to reproduce, and after that, you can go further ahead and look for the fix.

@bansalnitish
Copy link
Contributor

Hi @import-keshav, Any updates on this issue ? We need to fix these user-facing bugs soon! Let us know if you are stuck somewhere, we'll be happy to help you out.

Thanks!

@import-keshav
Copy link
Contributor

Sorii @DubeySandeep @bansalnitish, for not giving any updates.
When I go through the above comment

if it calls after every 5 minutes when user login then this will always occur because this function calls
UrlInterpolationService service function interpolateUrl which expects a string but it was giving null until a user starts any exploration.

StatsReportingService gets initialized only when users start playing exploration (over here). Once a user leaves an exploration the tab gets refreshed and the $interval function gets cleared. Also, this $ interval doesn't get called in the preview mode.

then the assumption I was assuming above was incorrect. So currently i was investigating it and give updates ASAP thanks!

@import-keshav
Copy link
Contributor

import-keshav commented Feb 24, 2019

Hello @bansalnitish @DubeySandeep, I investigate further for the issue and I stuck somewhere so please help me.
So as we see in the issue details the error is Error: Parameters passed into interpolateUrl must be strings..The reason for this error is there is a variable which is always passed to function interpolateUrl i.e exploration id which is not a string. And in my opinion, there is only two reason for that

  1. The exploration id generated is not a string. Maybe exploration id have other data type but not strings.
  2. Or maybe the exploration id variable is not set to original exploration id ( It is initialized with null the exploration id variable).

But since the 1st possibility is not there because if the exploration id is null then the exploration player will not run the exploration and throws an error.

And the reason for the second possibility is maybe some other services were using this service(StatsReportingService) and the other services scripts import is earlier than this service scripts import due to which the exploration id variable in StatsReportingService is null and may through this error.
But I am not confirmed that this reason(2nd one) is correct or not as I was not able to generate this issue locally.
So i need some help and suggestions from you that what are some other possibilities for the generation of this issue and is the secound reason is correct?
Thanks.

@DubeySandeep
Copy link
Member

@import-keshav, Thanks for looking into it.

  1. The exploration id generated is not a string. Maybe exploration id have other data type but not strings

Can you please look for the place where we use to generate exp_id? I don't think this will be possible cause.

So I need some help and suggestions from you that what are some other possibilities for the generation of this issue and is the second reason is correct?

I'm not sure about how you can reproduce this issue, but I agree that it can happen when we will be running StatsReportingService.record* function before StatsReportingService.initSession. I would suggest you to check how when and where StatsReportingService.initSession get called that would may help you out reasoning the cause of this issue!

@import-keshav
Copy link
Contributor

import-keshav commented Feb 25, 2019

Thanks @DubeySandeep for the response.

Can you please look for the place where we use to generate exp_id? I don't think this will be possible cause.

yes, you are right, that's can't possible that's why I also mentioned that this is not a reason for this.
And it generated in core/templates/dev/head/services/ContextService.js
So we have left with only one option.
So i will futher investigate it and give response ASAP.
Thanks

@import-keshav
Copy link
Contributor

import-keshav commented Feb 25, 2019

And one more thing to ask, as @DubeySandeep told

I'm not sure about how you can reproduce this issue, but I agree that it can happen when we will be running StatsReportingService.record* function before StatsReportingService.initSession. I would suggest you to check how when and where StatsReportingService.initSession get called that would may help you out reasoning the cause of this issue!

so instead of checking it, did I rearrange scripts import? It would not create any code break (I think)

@import-keshav
Copy link
Contributor

@DubeySandeep

@bansalnitish
Copy link
Contributor

Hi @import-keshav, Thanks for looking into the issue. For your query above:

so instead of checking it, did I rearrange scripts import? It would not create any code break (I think)

I would suggest to check what @DubeySandeep has suggested. Also, try to draw a sequence diagram of what is actually happening to reproduce the issue (You can refer this comment for making a sequence diagram) .

We need to have a clear idea of why this issue happens instead of just adding a fix without finding the actual cause.

@import-keshav
Copy link
Contributor

Thanks @bansalnitish for the response.
Ok i will make a sequence of diagram that describes the problem of the issue.
Thanks

@import-keshav import-keshav pinned this issue Mar 9, 2019
@anubhavsinha98 anubhavsinha98 unpinned this issue Mar 9, 2019
@import-keshav import-keshav removed their assignment Mar 23, 2019
@import-keshav import-keshav self-assigned this Mar 29, 2019
@import-keshav import-keshav removed their assignment Apr 22, 2019
@bansalnitish
Copy link
Contributor

bansalnitish added a commit to bansalnitish/oppia that referenced this issue Jun 17, 2019
@bansalnitish bansalnitish mentioned this issue Jun 17, 2019
8 tasks
aks681 pushed a commit that referenced this issue Jun 18, 2019
@kevintab95
Copy link
Member

This error occured recently, here is the latest stack trace:

Error: Parameters passed into interpolateUrl must be strings.
Undefined exploration id error debug logs:
The event being recorded: STATS_EVENTS
Exploration ID: 9trAQhj6uUC2
    at Object.t.fatalWarning (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:20202)
    at Object.interpolateUrl (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:2082)
    at O (https://www.oppia.org/build/templates/head/dist/exploration_player.7ffb86dc0e11b2a7a24b.bundle.js:1:269405)
    at w (https://www.oppia.org/build/templates/head/dist/exploration_player.7ffb86dc0e11b2a7a24b.bundle.js:1:269784)
    at https://www.oppia.org/build/templates/head/dist/exploration_player.7ffb86dc0e11b2a7a24b.bundle.js:1:269746
    at n (https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:107:61)
    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 https://www.oppia.org/third_party/static/angularjs-1.5.8/angular.min.js:107:358

@kevintab95
Copy link
Member

I was able to reproduce this locally. This would happen on a slow connection where the $interval sets off before the initSession function is called. I was able to reproduce this by tweaking the $interval duration to a shorter duration and throttling my connection speed.

initialised_later

I propose that we extract the $interval into it's own function and call it inside initSession. Since, it does not make sense to start a 5 minute timer before the page has completely loaded and exploration initialized. @DubeySandeep, @nithusha21 what are your thoughts?

@kevintab95
Copy link
Member

This error occurred with a different stacktrace:

Parameters passed into interpolateUrl must be strings.
    at Object.t.fatalWarning (webpack:///core/templates/dev/head/services/AlertsService.ts:67:18)
    at fatalWarning (webpack:///core/templates/dev/head/domain/utilities/UrlInterpolationService.ts:113:38)
    at interpolateUrl (webpack:///core/templates/dev/head/services/AssetsBackendApiService.ts:182:43)
    at _getDownloadUrl (webpack:///core/templates/dev/head/services/AssetsBackendApiService.ts:253:23)
    at getImageUrlForPreview (webpack:///extensions/rich_text_components/Image/directives/oppia-noninteractive-image.directive.ts:76:64)
    at apply (angular.js:4718:15)
    at invoke (angular.js:10354:23)

Reopening.

@kevintab95 kevintab95 reopened this Nov 9, 2019
vojtechjelinek pushed a commit that referenced this issue Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants