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

fix: give proper status code for invalid sequence metadata requests #29741

Conversation

asadiqbal08
Copy link
Contributor

If the sequence metadata view is asked to give metadata for a block
that is not a sequence (or section), give a proper http code back,
rather than throwing an attribute exception.

This avoids a monitoring error being flagged, and lets the frontend
catch this case specially (which the MFE does do, to notice that it
actually has a unit, not a sequence).

Description

After running Maple in production for a couple weeks, we began seeing errors link this in our logs:

Internal Server Error: /api/courseware/sequence/block-v1:MITx+18.031r_7+2022_IAP+type@vertical+block@rec2-tab1

AttributeError at /api/courseware/sequence/block-v1:MITx+18.031r_7+2022_IAP+type@vertical+block@rec2-tab1
'VerticalBlockWithMixins' object has no attribute 'get_metadata'

It seems to be associated with students experiencing timeouts when clicking the middle item in the Learner MFE breadcrumbs (the sequential).

Demo: 'VerticalBlockWithMixins' object has no attribute 'get_metadata'

Supporting information

fixes: openedx/wg-build-test-release#129
Contain the changes of edx/edx-platform@7123807

If the sequence metadata view is asked to give metadata for a block
that is not a sequence (or section), give a proper http code back,
rather than throwing an attribute exception.

This avoids a monitoring error being flagged, and lets the frontend
catch this case specially (which the MFE does do, to notice that it
actually has a unit, not a sequence).
@asadiqbal08 asadiqbal08 force-pushed the asadiqbal08/backport-learning-mfe-error-fixx branch from 59c001b to 1faf355 Compare January 13, 2022 11:16
@openedx-webhooks
Copy link

Thanks for the pull request, @asadiqbal08! I've created OSPR-6384 to keep track of it in JIRA, where we prioritize reviews. Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@openedx-webhooks openedx-webhooks added needs triage open-source-contribution PR author is not from Axim or 2U labels Jan 13, 2022
@pdpinch pdpinch merged commit a76a79f into openedx:open-release/maple.master Jan 14, 2022
@openedx-webhooks
Copy link

@asadiqbal08 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@natabene
Copy link
Contributor

@asadiqbal08 Thank you for your contribution,.

pdpinch added a commit to mitodl/edx-platform that referenced this pull request Jan 14, 2022
…equests (openedx#29741)"

This reverts commit a76a79f.

it was a backport of openedx#29741 but it was breaking unit tests
regisb added a commit to overhangio/tutor that referenced this pull request Feb 1, 2022
regisb added a commit to overhangio/tutor that referenced this pull request Feb 1, 2022
regisb added a commit to overhangio/tutor that referenced this pull request Feb 1, 2022
mshukurlu pushed a commit to mshukurlu/edx-platform that referenced this pull request Feb 9, 2022
…penedx#29741)

If the sequence metadata view is asked to give metadata for a block
that is not a sequence (or section), give a proper http code back,
rather than throwing an attribute exception.

This avoids a monitoring error being flagged, and lets the frontend
catch this case specially (which the MFE does do, to notice that it
actually has a unit, not a sequence).

Co-authored-by: Michael Terry <mterry@edx.org>
ztraboo pushed a commit to CUCWD/edx-platform that referenced this pull request May 27, 2022
…penedx#29741)

If the sequence metadata view is asked to give metadata for a block
that is not a sequence (or section), give a proper http code back,
rather than throwing an attribute exception.

This avoids a monitoring error being flagged, and lets the frontend
catch this case specially (which the MFE does do, to notice that it
actually has a unit, not a sequence).

Co-authored-by: Michael Terry <mterry@edx.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged open-source-contribution PR author is not from Axim or 2U
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants