oppia: The supplied input topic: undefined is not valid
This error occurred recently in production:
Error: The supplied input topic: undefined is not valid
at contribution-opportunities-backend-api.service.ts:196:13
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 zone.js:891:38
Where did the error occur? Contributor dashboard page.
Frequency of occurrence ~10 times in 13 days.
Additional context
Error occurred for the GET request to /getreviewableopportunitieshandler?topic_name=undefined
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.
- 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.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 21 (21 by maintainers)
@seanlip I have created debugging doc PTAL . If there is any changes please let me know , let start talk on doc.
Sure. Just a note, you might find it useful to read the “What we are looking for” section in the server errors project idea on the wiki.
@mosin74 We are not looking for the approach that is technically easiest. We are looking for the approach that correctly meets the expected user behaviour.
How is the default value for the topic name dropdown currently determined? When I go to my review page on the oppia.org contributors’ dashboard, the dropdown is automatically populated with “Ratios and Proportional Reasoning” – does it remember my last selection? If so, we should preserve that behaviour (and understand, in the current flow, why it is not being preserved).
With regards to solving issues like this, seeing that you understand what the current flow is and what the actual cause of the bug is is a very important first step. The fix is usually straightforward once a proper understanding is achieved. So I would advise you to focus on the former, first.
@seanlip Steps to Reproduce the Issue :
Open the Network tab in your browser’s developer tools and set the network speed to 3G (slow network) to simulate delayed rendering.
Navigate to the Contributor Dashboard. In some cases, an API call may be triggered with topic_name = undefined, possibly because the call is made before the view renders, i.e., before any value is set for topic_name.
Change the topic_name, then: Navigate to another page and return, or Reload the current page.
Observe the error occurred, which occurs because the API call is made before the view is rendered. This leads to the request being sent with topic_name as undefined, as no value is initialized before the API call.
@mosin74 This is good progress, but I’m going to point you back to the description of this issue: “Based on your hypothesis, determine a list of steps that reliably reproduce the issue (or confirm any repro instructions that have been provided).”
Can you provide this list of steps, in a numbered list? Thanks.
@mosin74 Your repro steps aren’t repro steps. Repro steps need to be user actions. Given that this occurred 10 times in 13 days it seems quite unlikely that someone is intentionally modifying the TS code to produce this error. The first step is therefore to find the sequence of user actions that cause this error to happen.
For example, maybe some caller of the function is incorrectly passing undefined to it – more investigation needs to be done to understand that, not just “if, for any reason, topicName is undefined”.