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

Malformed markup in opportunity summary description causes front-end opportunity listing page to error #2776

Open
1 task done
lucasmbrown-usds opened this issue Nov 7, 2024 · 0 comments

Comments

@lucasmbrown-usds
Copy link
Collaborator

lucasmbrown-usds commented Nov 7, 2024

Summary

For some opportunities, the front-end is giving 500 errors when trying to render the page.

@chouinar believes this is because the opportunity summary description contains malformed HTML:

. On a hunch, I just copied one of them to my local DB and the local frontend now fails with:
⨯ Error: Malformed markup: improperly closed tag
at Array.from.reduce.preSplit (./src/utils/generalUtils.ts:36:23)
at Array.reduce ()
at splitMarkup (./src/utils/generalUtils.ts:20:62)
at SummaryDescriptionDisplay (./src/components/opportunity/OpportunityDescription.tsx:74:104)
at stringify ()
at stringify ()
digest: "3520062763"
38 | if (tracker.openTagIndicator && character === "/") {
39 | if (tracker.closeTagIndicator) {

40 | throw new Error("Malformed markup: improperly closed tag");
| ^
41 | }
42 | tracker.closeTagIndicator = true;
43 | }
⨯ src/utils/generalUtils.ts (40:17) @ Array.from.reduce.preSplit
⨯ Error: Malformed markup: improperly closed tag
at Array.from.reduce.preSplit (./src/utils/generalUtils.ts:36:23)
at Array.reduce ()
at splitMarkup (./src/utils/generalUtils.ts:20:62)
at SummaryDescriptionDisplay (./src/components/opportunity/OpportunityDescription.tsx:74:104)
at stringify ()
at stringify ()

We think this affects, at maximum, 20% of opportunity listings: from @chouinar again, "I’ve looked into it before as the frontend wanted to know how common HTML tags were. It was somewhere in the 10-20% range." Hopefully not all those listings contain malformed HTML.

It feels like, from poking around, it probably affects more like 2% of listings, maybe. We don't know yet. Google Analytics or New Relic might have more info.

Reproducibility

I tried multiple times and saw the bug every time

How to reproduce the bug

  1. Visit any of the following opportunity listings, which are all from USDA-FNS1:

https://simpler.grants.gov/opportunity/356878
https://simpler.grants.gov/opportunity/356877
https://simpler.grants.gov/opportunity/356876
https://simpler.grants.gov/opportunity/309362

  1. Notice that the request to get the front-end page for that listing gives a 500 error, and the UI displays the following error:

Image

Browser

Chrome

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant