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

[Bug]: Not able to certify reporting period #452

Closed
ClaireValdivia opened this issue Sep 27, 2024 · 2 comments · Fixed by #468
Closed

[Bug]: Not able to certify reporting period #452

ClaireValdivia opened this issue Sep 27, 2024 · 2 comments · Fixed by #468

Comments

@ClaireValdivia
Copy link

Why is this issue important?

Org Admin & USDR Admin should be able to certify reporting periods in order to prevent new uploads to that reporting period and allow users to upload to the subsequent reporting period

Current State

In staging for the org "Main Agency", I logged in as an organization admin ([email protected])

  • I went to the Reporting Periods tab
  • I clicked the "Certify Reporting Period" button for the reporting period "October 2023 to December 2023"
  • When the modal popped up, I clicked "Certify"
  • A toast message pops up with the error "Unable to certify the current reporting period"

Image

Expected State

  • On the reporting period page, the "Certified At" column will update to display: "[Date Certified] by [email of user who certified]" ex: "07/01/2024 by [email protected]"
  • The next reporting period in terms of next upcoming start date (USDR Staging test) will become the default reporting period and users will be able to upload files for that period.

Implementation Plan

The following functions need to be added...

Relevant Code Snippets

No response

@Vikariusu
Copy link
Contributor

Seems like the issue is caused by a timeout used by the Prisma transaction.
We can increase maxWait like this: { maxWait: 5000, } // default: 2000 but ideally we should optimize the transaction as well (we should be able to move some queries outside of the transaction).

Datadog link

PrismaClientKnownRequestError: 
Invalid `prisma.reportingPeriodCertification.create()` invocation in
/var/task/api/dist/services/reportingPeriods/reportingPeriods.js:171:49

  168 if (!nextReportingPeriod) {
  169   throw new Error("No next reporting period found");
  170 }
→ 171 await prisma.reportingPeriodCertification.create(
Transaction API error: Transaction already closed: A query cannot be executed on an expired transaction. The timeout for this transaction was 5000 ms, however 5011 ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction.
    at In.handleRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:122:6854)
    at In.handleAndLogRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:122:6188)
    at In.request (/var/task/node_modules/@prisma/client/runtime/library.js:122:5896)
    at async l (/var/task/node_modules/@prisma/client/runtime/library.js:127:10871)
    at async /var/task/api/dist/services/reportingPeriods/reportingPeriods.js:171:7
    at async Proxy._transactionWithCallback (/var/task/node_modules/@prisma/client/runtime/library.js:127:9534)
    at async Object.certifyReportingPeriodAndOpenNextPeriod (/var/task/api/dist/services/reportingPeriods/reportingPeriods.js:149:32)

@Vikariusu Vikariusu self-assigned this Oct 2, 2024
@Vikariusu Vikariusu linked a pull request Oct 2, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Staging in Grants Team Agile Planning Oct 2, 2024
@ClaireValdivia
Copy link
Author

@Vikariusu I am now able to get through the certify workflow and it is looking as expected! The reporting period page updates as expected and the uploads default to the new reporting period.

The only issue I'm seeing is that the treasury report does not seem to reflect the new reporting period after the old one is certified. I've created an issue for it here: #483

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants