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

Requirement TypeError Preventing Communication with Database #672

Open
noschiff opened this issue Mar 27, 2022 · 2 comments
Open

Requirement TypeError Preventing Communication with Database #672

noschiff opened this issue Mar 27, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@noschiff
Copy link
Member

noschiff commented Mar 27, 2022

I've seen a few cases of CoursePlan not saving changes made by the user as a result of an Uncaught TypeError. When this happens, we get an error on loading the page and when the user makes and changes to their semester plan (adding or removing or changing courses): Uncaught TypeError: Cannot read properties of undefined (reading 'allowCourseDoubleCounting'). My account on production has this issue, rendering CoursePlan unusable because any changes made locally are not saved. I see this as a high priority bug.

bug.demo.on.prod.mov

I think I was able to reproduce this by manually changing data in Firestore. I’ve figured out that this error can happen when an illegal requirement is in the a user’s data for user-overridden-fulfillment-choices . An illegal requirement means both something that obviously doesn’t exist (gibberish text) and sometimes means a valid requirement that is under the wrong course. A difficulty in assessing if this is the actual cause of the bug on production the course ID is different for each course varies from user to user, so it's hard to tell if the data for my account "makes sense" and should be legal. It is definitely possible that my process of manually changing the data is actually never able to happen for a regular user and that the bug came from somewhere else. It would be helpful if we could figure out what courses correspond to course ID for my bugged account and determine if any data could possibly cause an issue and then look through the code to see how illegal data could get into the Firestore.

Nevertheless, the error I got when reproducing this on dev is the same as the error on prod, so I will explore the possibility that this is infcat the cause. For my dev account, course 77 for me is PHYS 1110, and thus shouldn’t be able to have a acknowledgedCheckerWarningOptIn for Major-CS-Computer Science Core, but there are no errors in the console:

image image

However, if Major-CS-Computer Science Core is added for PE 1571 (Course 75), we get the error:

uncaught.type.error.mov

I haven’t extensively tested this with the optOut field but I’ve noticed that there are also some requirements that don’t cause an error (such as College-EN-Mathematics for Course 76 for me — ANTHR 1101 — is a class that shouldn’t have anything to do with math). I don’t know too much about how this overridden data is being used, and I don't think this issue has anything to do with what major the user selected because this data seems to stay around after a user changes its major without causing issues. I assume we just need to add a check somewhere that the requirement is actually valid to fix this. It would be very helpful to figure out why only some requirements cause an error when it seems like a lot more should. Ideally, we could also figure out how we are getting illegal requirements, because like I said, it’s possible that this data is actually not the issue and it’s not possible to get bad data here just by usual interaction. If there’s any way to figure out what courses correspond to course IDs (now that those classes are deleted from the semester schedule and are not in the user-semesters collection), that could help us get a sense of whether anything actually went wrong there.

@noschiff noschiff changed the title Requirement TypeError Preventing Access to Firestore Requirement TypeError Preventing Communication with Database Mar 27, 2022
@noschiff
Copy link
Member Author

After @willespencer deleted the data for course 59 (CS 4820) in user-overridden-fulfillment-choices, the problem was resolved on prod. I am confident that the issue comes from user-overridden-fulfillment-choices. Course 59 previously had Major-EP-Major-approved Elective(s).

On dev, I switched to the Engineering Physics major, and tried to bind CS 4820 to the EP Major Approved electives, and this resulted in a (slightly different) TypeError. This actually happens for any class, not just CS 4820. The screnshot belows shows that Algo is not mapped to a requirement because I removed the CS major from my account and my account broke as I tried to assign Algo to the Major-approved Elective(s).

image

image

This error is not the same as the original one with 'allowCourseDoubleCounting', but it is similar. I'm not entirely sure if I added CS 4820 using the drop-down or added it to my schedule. It should be noted that there are other weird occurrences with this adding process, such as CS 2112 initially being an option to add but not being an option upon refresh.

@noschiff
Copy link
Member Author

Just switched my major & minors and got this on dev firebase.
image

Previously: CS + ORIE majors, Applied Math minor
Now: CS major, ORIE minor
Firebase: dev (https://console.firebase.google.com/project/cornelldti-courseplan-dev/firestore/data/~2Fuser-semesters)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant