oppia icon indicating copy to clipboard operation
oppia copied to clipboard

TypeError: Cannot read properties of undefined (reading 'replace')

Open kevintab95 opened this issue 2 years ago • 19 comments

This error occurred recently in production:

TypeError: Cannot read properties of undefined (reading 'replace')
    at c.transform (format-rte-preview.pipe.ts:35:17)
    at an.getTranslationSuggestionHeading (contributions-and-review.component.ts:255:38)
    at contributions-and-review.component.ts:231:23
    at Array.forEach (<anonymous>)
    at an.getTranslationContributionsSummary (contributions-and-review.component.ts:216:44)
    at an.getContributionSummaries (contributions-and-review.component.ts:412:19)
    at contributions-and-review.component.ts:498:34
    at e.invoke (zone.js:386:30)
    at Object.onInvoke (core.js:28580:33)
    at e.invoke (zone.js:385:36)

Where did the error occur? Add the page the error occurred on.

Contributor dashboard page.

Frequency of occurrence Add details about how many times the error occurred within a given time period (e.g. the last week, the last 30 days, etc.). This helps issue triagers establish severity.

1 time in 4 days.

General instructions for contributors In general, the procedure for fixing 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.
  • Based on your hypothesis, determine a list of steps that reliably reproduce the issue (or confirm any repro instructions that have been provided). For example, if your hypothesis is that the issue arises due to a delay in a response from the backend server, try to change the code so that the backend server always has a delay, and see if the error then shows up 100% of the time on your local machine.
    • NOTE: See this comment for repro instructions (thanks @Ash-2k3 !)
  • Explain your proposed fix, the logic behind it, and any other findings/context you have on this thread. You can also link to a debugging doc if you prefer.
  • Get your approach validated by an Oppia team member.
  • Make a PR that fixes the issue.

Additionally, see https://github.com/oppia/oppia/wiki/Contributor-dashboard for how to get started for developing for the contributor dashboard.

kevintab95 avatar Sep 25 '23 07:09 kevintab95

Hi @sagangwee, thanks for proposing this as a good first issue. I am removing the label for now and looping in @DubeySandeep to approve the label. It will be added back if approved. Thanks!

github-actions[bot] avatar Sep 25 '23 18:09 github-actions[bot]

@DubeySandeep I would like to work on this. Could you please assign me this?

aakankshabhende avatar Sep 26 '23 11:09 aakankshabhende

@aakankshabhende My apologies for the oversight. I initially labeled this as a "good first issue", but upon further examination, it seems to be a server error that requires in-depth debugging. Currently, we're unsure about the steps to reproduce this error, making it challenging to estimate the workload. To ensure that new contributors have a smooth start, I've removed the "good-first-issue" tag from this.

I recommend considering this issue instead: https://github.com/oppia/oppia/issues/17351

If you're interested in tackling that one, please indicate on the issue thread. Additionally, feel free to ask any questions related to it.

DubeySandeep avatar Sep 26 '23 14:09 DubeySandeep

From the error snippet, it looks like the suggestion's translation (suggestion.change.translation_html) is undefined.

sagangwee avatar Sep 26 '23 15:09 sagangwee

@DubeySandeep I would like to work on this issue once we get some clarity on this but till then could you please assign me the issue #17351

aakankshabhende avatar Sep 27 '23 13:09 aakankshabhende

This issue occurs on the server about 1 time in a day.

kevintab95 avatar Dec 09 '23 22:12 kevintab95

This error is reproducible in local server for translations with rule inputs.

Ash-2k3 avatar Mar 12 '24 15:03 Ash-2k3

@Ash-2k3 Would you mind providing full repro instructions if possible? That would be pretty useful for server errors in general -- it converts the issue to a "normal" one.

Thanks!

seanlip avatar Mar 12 '24 15:03 seanlip

Repro instructions

We need two different accounts, one to submit translation suggestion and other one to review it. (Note that both accounts need to have translation review rights, as only translation reviewers can submit translations for rule inputs. For more details on this, refer :https://github.com/oppia/oppia/issues/12959 )

Steps to reproduce:

  1. Log in as an admin
  2. Go to the /admin page under the "Roles" tab, and give yourself the following roles:
    • Curriculum Admin
    • Translation Admin
  3. In activities tab of admin page, click on load date for Load dummy new structures data (only curriculum admins)
  4. Go to url /contributor-dashboard-admin and give both the accounts review translation rights in the Akan language.
  5. Go to the contributor dashboard page under the "Translate Text" tab, and submit suggestions in Akan language for the listed opportunity titled as "What are Place Values ?" (This exploration has the content cards for rule inputs ).
  6. Log in with the second account
  7. (While doing step 7 make sure you have your browser console toggled on) Go to the contributor dashboard page under the "Review Translations" tab, and click on the opportunity listed. Finally, click on the listed suggestion. Observe the browser console errors and terminal errors (switch back to your terminal to check this).

Ash-2k3 avatar Mar 12 '24 16:03 Ash-2k3

Browser Console:

logger.service.ts:59 this.rteString.replace is not a function error @ logger.service.ts:59 handleError @ app-error-handler.ts:85 eval @ core.js:30009 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 tick @ core.js:30009 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onLeave @ core.js:29072 onInvokeTask @ core.js:29016 ZoneDelegate.invokeTask @ zone.js:424 Zone.runTask @ zone.js:192 ZoneTask.invokeTask @ zone.js:507 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 26 more frames Show less TranslationSuggestionReviewModalComponent.html:52 ERROR TypeError: this.rteString.replace is not a function at RteOutputDisplayComponent._updateNode (rte-output-display.component.ts:60:41) at RteOutputDisplayComponent.ngOnChanges (rte-output-display.component.ts:161:18) at checkAndUpdateDirectiveInline (core.js:25111:19) at checkAndUpdateNodeInline (core.js:32301:20) at checkAndUpdateNode (core.js:32263:16) at debugCheckAndUpdateNode (core.js:32890:21) at debugCheckDirectivesFn (core.js:32854:13) at Object.eval [as updateDirectives] (TranslationSuggestionReviewModalComponent.html:52:11) at Object.debugUpdateDirectives [as updateDirectives] (core.js:32850:21) at checkAndUpdateView (core.js:32245:14) View_TranslationSuggestionReviewModalComponent_7 @ TranslationSuggestionReviewModalComponent.html:52 logError @ core.js:33039 handleError @ core.js:6700 handleError @ app-error-handler.ts:86 eval @ core.js:30009 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 tick @ core.js:30009 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber.next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onLeave @ core.js:29072 onInvokeTask @ core.js:29016 ZoneDelegate.invokeTask @ zone.js:424 Zone.runTask @ zone.js:192 ZoneTask.invokeTask @ zone.js:507 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 28 more frames Show less TranslationSuggestionReviewModalComponent.html:52 ERROR CONTEXT DebugContext {view: {…}, nodeIndex: 1, nodeDef: {…}, elDef: {…}, elView: {…}} View_TranslationSuggestionReviewModalComponent_7 @ TranslationSuggestionReviewModalComponent.html:52 logError @ core.js:33039 handleError @ core.js:6705 handleError @ app-error-handler.ts:86 eval @ core.js:30009 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 tick @ core.js:30009 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onLeave @ core.js:29072 onInvokeTask @ core.js:29016 ZoneDelegate.invokeTask @ zone.js:424 Zone.runTask @ zone.js:192 ZoneTask.invokeTask @ zone.js:507 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 28 more frames Show less logger.service.ts:59 this.rteString.replace is not a function error @ logger.service.ts:59 handleError @ app-error-handler.ts:85 eval @ core.js:30009 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 tick @ core.js:30009 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onHasTask @ core.js:29039 ZoneDelegate.hasTask @ zone.js:445 ZoneDelegate._updateTaskCount @ zone.js:466 Zone._updateTaskCount @ zone.js:288 Zone.runTask @ zone.js:209 drainMicroTaskQueue @ zone.js:605 ZoneTask.invokeTask @ zone.js:511 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 28 more frames Show less TranslationSuggestionReviewModalComponent.html:52 ERROR TypeError: this.rteString.replace is not a function at RteOutputDisplayComponent._updateNode (rte-output-display.component.ts:60:41) at RteOutputDisplayComponent.ngAfterViewInit (rte-output-display.component.ts:116:14) at callProviderLifecycles (core.js:25427:18) at callElementProvidersLifecycles (core.js:25401:13) at callLifecycleHooksChildrenFirst (core.js:25391:29) at checkAndUpdateView (core.js:32254:5) at callViewAction (core.js:32486:21) at execEmbeddedViewsAction (core.js:32449:17) at checkAndUpdateView (core.js:32246:5) at callViewAction (core.js:32486:21) View_TranslationSuggestionReviewModalComponent_7 @ TranslationSuggestionReviewModalComponent.html:52 logError @ core.js:33039 handleError @ core.js:6700 handleError @ app-error-handler.ts:86 eval @ core.js:30009 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 tick @ core.js:30009 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onHasTask @ core.js:29039 ZoneDelegate.hasTask @ zone.js:445 ZoneDelegate._updateTaskCount @ zone.js:466 Zone.updateTaskCount @ zone.js:288 Zone.runTask @ zone.js:209 drainMicroTaskQueue @ zone.js:605 ZoneTask.invokeTask @ zone.js:511 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 30 more frames Show less TranslationSuggestionReviewModalComponent.html:52 ERROR CONTEXT DebugContext {view: {…}, nodeIndex: 1, nodeDef: {…}, elDef: {…}, elView: {…}} View_TranslationSuggestionReviewModalComponent_7 @ TranslationSuggestionReviewModalComponent.html:52 logError @ core.js:33039 handleError @ core.js:6705 handleError @ app-error-handler.ts:86 eval @ core.js:30009 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 tick @ core.js:30009 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onHasTask @ core.js:29039 ZoneDelegate.hasTask @ zone.js:445 ZoneDelegate._updateTaskCount @ zone.js:466 Zone._updateTaskCount @ zone.js:288 Zone.runTask @ zone.js:209 drainMicroTaskQueue @ zone.js:605 ZoneTask.invokeTask @ zone.js:511 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 30 more frames Show less logger.service.ts:59 Cannot read properties of undefined (reading 'elementRef') error @ logger.service.ts:59 handleError @ app-error-handler.ts:85 next @ core.js:29625 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 eval @ core.js:29048 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 onHandleError @ core.js:29048 ZoneDelegate.handleError @ zone.js:394 Zone.runTask @ zone.js:195 ZoneTask.invokeTask @ zone.js:507 ZoneTask.invoke @ zone.js:496 timer @ zone.js:3038 setTimeout (async) scheduleTask @ zone.js:3059 ZoneDelegate.scheduleTask @ zone.js:411 onScheduleTask @ zone.js:298 ZoneDelegate.scheduleTask @ zone.js:404 Zone.scheduleTask @ zone.js:235 Zone.scheduleMacroTask @ zone.js:258 scheduleMacroTaskWithCurrentZone @ zone.js:1187 eval @ zone.js:3072 proto. @ zone.js:1505 computePanelOverflowState @ translation-suggestion-review-modal.component.ts:217 ngAfterViewInit @ translation-suggestion-review-modal.component.ts:225 callProviderLifecycles @ core.js:25427 callElementProvidersLifecycles @ core.js:25401 callLifecycleHooksChildrenFirst @ core.js:25391 checkAndUpdateView @ core.js:32254 callWithDebugContext @ core.js:33076 debugCheckAndUpdateView @ core.js:32818 detectChanges @ core.js:24808 tick @ core.js:29997 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onLeave @ core.js:29072 onInvokeTask @ core.js:29016 ZoneDelegate.invokeTask @ zone.js:424 Zone.runTask @ zone.js:192 ZoneTask.invokeTask @ zone.js:507 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 _setFocus @ ng-bootstrap.js:5960 _show @ ng-bootstrap.js:5909 eval @ ng-bootstrap.js:5878 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 TakeSubscriber._next @ take.js:45 Subscriber.next @ Subscriber.js:62 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 eval @ core.js:28965 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 checkStable @ core.js:28965 onHasTask @ core.js:29039 ZoneDelegate.hasTask @ zone.js:445 ZoneDelegate._updateTaskCount @ zone.js:466 Zone._updateTaskCount @ zone.js:288 Zone.runTask @ zone.js:209 drainMicroTaskQueue @ zone.js:605 ZoneTask.invokeTask @ zone.js:511 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 84 more frames Show less app-error-handler.ts:86 ERROR TypeError: Cannot read properties of undefined (reading 'elementRef') at eval (translation-suggestion-review-modal.component.ts:218:60) at ZoneDelegate.invokeTask (zone.js:425:35) at Object.onInvokeTask (core.js:29009:33) at ZoneDelegate.invokeTask (zone.js:424:40) at Zone.runTask (zone.js:192:51) at ZoneTask.invokeTask (zone.js:507:38) at ZoneTask.invoke (zone.js:496:52) at timer (zone.js:3038:33) defaultErrorLogger @ core.js:6652 handleError @ core.js:6700 handleError @ app-error-handler.ts:86 next @ core.js:29625 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 eval @ core.js:29048 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 onHandleError @ core.js:29048 ZoneDelegate.handleError @ zone.js:394 Zone.runTask @ zone.js:195 ZoneTask.invokeTask @ zone.js:507 ZoneTask.invoke @ zone.js:496 timer @ zone.js:3038 setTimeout (async) scheduleTask @ zone.js:3059 ZoneDelegate.scheduleTask @ zone.js:411 onScheduleTask @ zone.js:298 ZoneDelegate.scheduleTask @ zone.js:404 Zone.scheduleTask @ zone.js:235 Zone.scheduleMacroTask @ zone.js:258 scheduleMacroTaskWithCurrentZone @ zone.js:1187 eval @ zone.js:3072 proto. @ zone.js:1505 computePanelOverflowState @ translation-suggestion-review-modal.component.ts:217 ngAfterViewInit @ translation-suggestion-review-modal.component.ts:225 callProviderLifecycles @ core.js:25427 callElementProvidersLifecycles @ core.js:25401 callLifecycleHooksChildrenFirst @ core.js:25391 checkAndUpdateView @ core.js:32254 callWithDebugContext @ core.js:33076 debugCheckAndUpdateView @ core.js:32818 detectChanges @ core.js:24808 tick @ core.js:29997 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onLeave @ core.js:29072 onInvokeTask @ core.js:29016 ZoneDelegate.invokeTask @ zone.js:424 Zone.runTask @ zone.js:192 ZoneTask.invokeTask @ zone.js:507 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 _setFocus @ ng-bootstrap.js:5960 _show @ ng-bootstrap.js:5909 eval @ ng-bootstrap.js:5878 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 TakeSubscriber._next @ take.js:45 Subscriber.next @ Subscriber.js:62 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 eval @ core.js:28965 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 checkStable @ core.js:28965 onHasTask @ core.js:29039 ZoneDelegate.hasTask @ zone.js:445 ZoneDelegate._updateTaskCount @ zone.js:466 Zone._updateTaskCount @ zone.js:288 Zone.runTask @ zone.js:209 drainMicroTaskQueue @ zone.js:605 ZoneTask.invokeTask @ zone.js:511 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 86 more frames Show less logger.service.ts:59 Cannot read properties of undefined (reading 'elementRef') error @ logger.service.ts:59 handleError @ app-error-handler.ts:85 next @ core.js:29625 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 eval @ core.js:29048 ZoneDelegate.invoke @ zone.js:390 Zone.run @ zone.js:147 runOutsideAngular @ core.js:28951 onHandleError @ core.js:29048 ZoneDelegate.handleError @ zone.js:394 Zone.runTask @ zone.js:195 ZoneTask.invokeTask @ zone.js:507 ZoneTask.invoke @ zone.js:496 timer @ zone.js:3038 setTimeout (async) scheduleTask @ zone.js:3059 ZoneDelegate.scheduleTask @ zone.js:411 onScheduleTask @ zone.js:298 ZoneDelegate.scheduleTask @ zone.js:404 Zone.scheduleTask @ zone.js:235 Zone.scheduleMacroTask @ zone.js:258 scheduleMacroTaskWithCurrentZone @ zone.js:1187 eval @ zone.js:3072 proto. @ zone.js:1505 computePanelOverflowState @ translation-suggestion-review-modal.component.ts:217 eval @ translation-suggestion-review-modal.component.ts:213 ZoneDelegate.invokeTask @ zone.js:425 onInvokeTask @ core.js:29009 ZoneDelegate.invokeTask @ zone.js:424 Zone.runTask @ zone.js:192 ZoneTask.invokeTask @ zone.js:507 ZoneTask.invoke @ zone.js:496 timer @ zone.js:3038 setTimeout (async) scheduleTask @ zone.js:3059 ZoneDelegate.scheduleTask @ zone.js:411 onScheduleTask @ zone.js:298 ZoneDelegate.scheduleTask @ zone.js:404 Zone.scheduleTask @ zone.js:235 Zone.scheduleMacroTask @ zone.js:258 scheduleMacroTaskWithCurrentZone @ zone.js:1187 eval @ zone.js:3072 proto. @ zone.js:1505 refreshActiveContributionState @ translation-suggestion-review-modal.component.ts:212 ngOnInit @ translation-suggestion-review-modal.component.ts:140 checkAndUpdateDirectiveInline @ core.js:25115 checkAndUpdateNodeInline @ core.js:32301 checkAndUpdateNode @ core.js:32263 debugCheckAndUpdateNode @ core.js:32890 debugCheckDirectivesFn @ core.js:32854 eval @ TranslationSuggestionReviewModalComponent_Host.ngfactory.js:1 debugUpdateDirectives @ core.js:32850 checkAndUpdateView @ core.js:32245 callWithDebugContext @ core.js:33076 debugCheckAndUpdateView @ core.js:32818 detectChanges @ core.js:24808 tick @ core.js:29997 eval @ core.js:29878 ZoneDelegate.invoke @ zone.js:390 onInvoke @ core.js:29022 ZoneDelegate.invoke @ zone.js:389 Zone.run @ zone.js:147 run @ core.js:28906 next @ core.js:29877 SafeSubscriber.__tryOrUnsub @ Subscriber.js:201 SafeSubscriber.next @ Subscriber.js:139 Subscriber._next @ Subscriber.js:85 Subscriber.next @ Subscriber.js:62 Subject.next @ Subject.js:57 emit @ core.js:26382 checkStable @ core.js:28959 onLeave @ core.js:29072 onInvokeTask @ core.js:29016 ZoneDelegate.invokeTask @ zone.js:424 Zone.runTask @ zone.js:192 ZoneTask.invokeTask @ zone.js:507 invokeTask @ zone.js:1675 globalZoneAwareCallback @ zone.js:1701 Show 74 more frames Show less app-error-handler.ts:86 ERROR TypeError: Cannot read properties of undefined (reading 'elementRef') at eval (translation-suggestion-review-modal.component.ts:218:60) at ZoneDelegate.invokeTask (zone.js:425:35) at Object.onInvokeTask (core.js:29009:33) at ZoneDelegate.invokeTask (zone.js:424:40) at Zone.runTask (zone.js:192:51) at ZoneTask.invokeTask (zone.js:507:38) at ZoneTask.invoke (zone.js:496:52) at timer (zone.js:3038:33)

Ash-2k3 avatar Mar 12 '24 16:03 Ash-2k3

Terminal error:

ERROR:root:Frontend error: this.rteString.replace is not a function

at URL: http://localhost:8181/contributor-dashboard

INFO 2024-03-12 16:13:29,107 module.py:883] default: "POST /frontend_errors HTTP/1.1" 200 72 ERROR:root:Frontend error: this.rteString.replace is not a function

at URL: http://localhost:8181/contributor-dashboard

INFO 2024-03-12 16:13:29,211 module.py:883] default: "POST /frontend_errors HTTP/1.1" 200 72 ERROR:root:Frontend error: Cannot read properties of undefined (reading 'elementRef')

at URL: http://localhost:8181/contributor-dashboard

INFO 2024-03-12 16:13:29,464 module.py:883] default: "POST /frontend_errors HTTP/1.1" 200 72 ERROR:root:Frontend error: Cannot read properties of undefined (reading 'elementRef')

at URL: http://localhost:8181/contributor-dashboard

Ash-2k3 avatar Mar 12 '24 16:03 Ash-2k3

Hmm upon comparing the logs mentioned in the issue description and the one I found, I am not sure if they are the same ? I don't think this.rteString.replace is not a function is the same as Cannot read properties of undefined (reading 'replace'). Maybe they are related ? @seanlip

Ash-2k3 avatar Mar 12 '24 16:03 Ash-2k3

@Ash-2k3 Not sure, needs investigation. It sounds like two issues:

  • The first one suggests that this.rteString doesn't have a "replace" method. But to understand what's going on here you'll need to know what the type of this.rteString is. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_function
  • The second one suggests that this.rteString is undefined.

I think it's worth fixing what you can repro anyway, since there seem to be several issues with how this.rteString is being handled. Maybe the stacktrace info can also help?

seanlip avatar Mar 13 '24 19:03 seanlip

Also @Ash-2k3 I don't think https://github.com/oppia/oppia/issues/18924#issuecomment-1992044276 suffices as instructions. Please give step-by-step repro instructions (e.g. step 1: log in as user XYZ and go to URL ABC, etc.), thanks.

seanlip avatar Mar 13 '24 19:03 seanlip

@seanlip, Thanks, I have updated my comment, lmk if anything else is needed.

Ash-2k3 avatar Mar 17 '24 17:03 Ash-2k3

Thanks @Ash-2k3, that looks much better! I made some small edits, it should be good to use now.

seanlip avatar Mar 18 '24 16:03 seanlip

@Ash-2k3 Also just to check, I think you've been making some fixes related to rule input translations. Do any of those fix this issue?

seanlip avatar Mar 18 '24 16:03 seanlip

Nope, I don't think so. I only fixed issue related to calculation of html strings for rule inputs (We didn't consider argument to be of type list of strings).

Ash-2k3 avatar Mar 18 '24 16:03 Ash-2k3

The error has occurred once on the test server in the release version 3-3-9 with the following logs:

Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'replace')
TypeError: Cannot read properties of undefined (reading 'replace')
    at c.transform (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:3815:141890)
    at _n.getTranslationSuggestionHeading (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:3982:229388)
    at https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:3982:228502
    at Array.forEach (<anonymous>)
    at _n.getTranslationContributionsSummary (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:3982:228291)
    at _n.getContributionSummaries (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:3982:232247)
    at https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:3982:234606
    at e.invoke (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:3439:7175)
    at Object.onInvoke (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:1377:1773)
    at e.invoke (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8a266c83a4158936980c.bundle.js:3439:7115)

    at URL: https://www.oppiatestserver.org/contributor-dashboard

lkbhitesh07 avatar May 12 '24 10:05 lkbhitesh07

The error occurred once on test-server since 9th Oct 2024 with version 3.4.3 with the following logs:

Frontend error: 
Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'replace')
TypeError: Cannot read properties of undefined (reading 'replace')
    at c.transform (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:3522:188511)
    at Qt.getTranslationSuggestionHeading (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:3652:204045)
    at https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:3652:203159
    at Array.forEach (<anonymous>)
    at Qt.getTranslationContributionsSummary (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:3652:202948)
    at Qt.getContributionSummaries (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:3652:206904)
    at https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:3652:209263
    at e.invoke (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:3295:7175)
    at Object.onInvoke (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:1377:1773)
    at e.invoke (https://www.oppiatestserver.org/build/webpack_bundles/contributor_dashboard.8581188dd2bd56a10de1.bundle.js:3295:7115)

    at URL: https://www.oppiatestserver.org/contributor-dashboard

lkbhitesh07 avatar Oct 10 '24 11:10 lkbhitesh07