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

500 error when an Opportunity is not found #3955

Closed
1 task done
mdragon opened this issue Feb 20, 2025 · 0 comments · Fixed by #3959
Closed
1 task done

500 error when an Opportunity is not found #3955

mdragon opened this issue Feb 20, 2025 · 0 comments · Fixed by #3959
Assignees

Comments

@mdragon
Copy link
Collaborator

mdragon commented Feb 20, 2025

Summary

Instead of getting a 404 error/page when an opportunity is accessed that no longer exists we're instead throwing 500 errors. This problem seems to have been introduced with Release 2025.02.19-1. This is a front end issue, the API is correctly responding with a 404. This caused the Cloudwatch Alert for FE 500 errors to fire off this morning, likely due to Google or other crawling based on the errors/minute counts. Likely will need to re-crawl affected pages via Google console once the issue has been resolved.

API request error at http://localhost:8080/v1/opportunities/10000000 (404): Could not find Opportunity with ID 10000000
Failed to render page title due to API error Error: Could not find Opportunity with ID 10000000
    at throwError (src/services/fetch/fetcherHelpers.ts:117:12)
    at jsonBody (src/services/fetch/fetchers/fetchers.ts:80:24)
    at async getOpportunityDetails (src/services/fetch/fetchers/opportunityFetcher.ts:8:19)
    at async Module.generateMetadata (src/app/[locale]/opportunity/[id]/page.tsx:42:38)
  115 |       throw new ForbiddenError(message, details);
  116 |     case 404:
> 117 |       throw new NotFoundError(message, details);
      |            ^
  118 |     case 422:
  119 |       throw new ValidationError(message, details);
  120 |     case 408: {
  [cause]: [Object]
}
Malformed error object
 GET /opportunity/10000000 500 in 193ms
API request error at http://localhost:8080/v1/opportunities/installHook.js.map (404): Not Found
Failed to render page title due to API error Error: Not Found
    at throwError (src/services/fetch/fetcherHelpers.ts:117:12)
    at jsonBody (src/services/fetch/fetchers/fetchers.ts:80:24)
    at async getOpportunityDetails (src/services/fetch/fetchers/opportunityFetcher.ts:8:19)
    at async Module.generateMetadata (src/app/[locale]/opportunity/[id]/page.tsx:42:38)
  115 |       throw new ForbiddenError(message, details);
  116 |     case 404:
> 117 |       throw new NotFoundError(message, details);
      |            ^
  118 |     case 422:
  119 |       throw new ValidationError(message, details);
  120 |     case 408: {
  [cause]: [Object]
}
Malformed error object

Reproducibility

I tried multiple times and saw the bug every time

How to reproduce the bug

Access an Opportunity ID that doesn't exist:
https://simpler.grants.gov/opportunity/358329
https://simpler.grants.gov/opportunity/1000000

Browser

Not applicable

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
1 participant