oppia: TypeError: Cannot read property 'status' of undefined

This error occurred recently in production

TypeError: Cannot read property 'status' of undefined
    at storyViewerBackendApiService.fetchStoryDataAsync.then.e (story-viewer-page.component.ts:255:46)
    at e.invoke (zone.js:386:30)
    at Object.onInvoke (core.js:28580:33)
    at e.invoke (zone.js:385:36)
    at t.run (zone.js:143:47)
    at <anonymous>:1:1

Additional context Add details from the logs, like the page the error occurred on. Make sure to anonymize user data like user IDs, exploration IDs, state names, user names, etc. Replace the personal data with appropriate placeholders.

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.)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 30 (29 by maintainers)

Most upvoted comments

Sorry @satvshr, I won’t be able to explain the basics, it will take too much of my time. I recommend walking through some programming courses. You can consult ChatGPT as well, it helps me from time to time.

Why do you think it does nothing? It’s an argument passed from some other function to this function. Take a look at the passed function and what it does. For example it could be like this

executeHttpRequest(body: string, errorCallback: (reason: string) => void) {
  const response = client.makeRequest(body);
  if (!response.success) {
    errorCallback("failed to send request");
  }
}

someOtherFunction() {
  const body = createBody();
  this.executeHttpRequest(body, (reason) => {
    console.log("failed request with reason: " + reason);
  });
}

Here errorCallback logs into console the error message. It returns nothing, but still does something.

Yes, that’s correct. Don’t forget to add test(s) to prevent this from happening again.

Sorry for the confusion. I was quoting you, hence the grey text.

The errorResponse is not defined there, those are tests. errorResponse is created somewhere inside the angular library based on the backend response.