Repository navigation
Aakash - Urgent Hotfix: volunteer dashboard tasks fail with 400 (backend) - #2404
Merged
Merged
Conversation
removeTaskExtensionCounts walked mongoose documents recursively to hide
deadlineCount. Documents reference their parents, so the walk never ended
(RangeError: Maximum call stack size exceeded) and the team tasks endpoint
returned 400 {"error":{}} for every user without seeNumberOfTimesTimeAdded,
i.e. all volunteers. It now strips the count from a plain JSON copy, which
is what res.send serializes anyway. getTaskById uses the returned copy too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Urgent hotfix (production). Since today's backend release to main (#2399, 3.17), the Dashboard's Team Member Tasks never loads for volunteers.
GET /api/user/:userId/teams/tasksreturns400 {"error":{}}for every requestor without theseeNumberOfTimesTimeAddedpermission (all volunteers). Admins and owners have that permission, so their dashboards still work. Reported by Jae on the account rukmangadaruku@gmail.com; I reproduced it on my own volunteer account on production (no extra permissions), so it is not caused by the new task deadlines permission.Related PRs (if any):
Main changes explained:
removeTaskExtensionCounts(taskController.js) hidesdeadlineCountby walking the response recursively. The team tasks response contains mongoose documents (populatedteams), which hold references back to their parents, so the walk never ends:RangeError: Maximum call stack size exceeded. The catch block returns it as 400, and the empty{}body is the serialized RangeError.deadlineCountfrom a plain JSON copy instead (JSON.parse(JSON.stringify(value))). That copy is exactly whatres.sendserializes anyway, so the response shape is unchanged, and it has no cycles.getTaskByIdused the same function only for its in-place side effect; it now sends the returned copy (same fix for volunteers opening a single task).seeNumberOfTimesTimeAddedstill receivedeadlineCountunchanged.How to test:
npm install,npm run build,npm start.npx jest src/controllers/taskController.spec.js: 59 tests pass, including 2 new ones (cyclic documents without the count permission return 200 withdeadlineCountremoved; with the permission it is kept).teams/tasks400).Test evidence:
RangeError: Maximum call stack size exceeded) and passes with the fix.400for a volunteer viewing their own tasks and a teammate's. After:200with the team member list and tasks.400 {"error":{}}before the fix,200after the deploy (see screenshots).Screenshots (production, volunteer account)
Before the fix: Team Member Tasks stays on grey placeholder rows;

GET /api/user/<id>/teams/tasksreturned400 {"error":{}}.After the fix (deployed 17:43 PT on 2026-10-13): the same dashboard lists the assigned tasks; the endpoint returns

200anddeadlineCountis left out for a volunteer.Note:
Base is
mainbecause production is broken now; the same change should go todevelopment(I can open the matching PR, or it can come back with the next release merge).