Skip to content

Submissions api returning error :Cannot read property 'allPhases' of undefined" sometimes #188

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

Closed
SathyaJayabal opened this issue Jul 6, 2020 · 7 comments

Comments

@SathyaJayabal
Copy link
Collaborator

@callmekatootie
topcoder-platform/community-app#4628

@callmekatootie
Copy link
Contributor

@rootelement I do not have authorization but could you kindly check the prod logs and see if there's an issue accessing the v5 challenge api or could you try this query GET api.topcoder.com/v5/challenges/d9b51702-711f-4ee4-93ab-5af4271e83f3 with your auth.

The issue seems to be coming from when submission api is trying to read the phases of the contest... If the request is returning with data, try this request next - GET api.topcoder.com/v4/challenges?filter=id=<thelegacyId> where you substitute the legacy id with the one returned from the above api call... and verify the payload (or could you share that here)

@callmekatootie
Copy link
Contributor

@rootelement Was able to access the endpoints that I mentioned with help from picachui. Considering that the api uses m2m tokens to access the challenge details and the one I used were user tokens, could you check if the endpoints are accessible using the m2m tokens in prod?

@callmekatootie
Copy link
Contributor

callmekatootie commented Jul 6, 2020

The challenge in question basically requires the user to be part of some group, in order to access the details. While I do see this code checking if it's a m2m token or not, I am not sure about it and hence requesting to check once with the m2m token

@rootelement
Copy link
Contributor

I can get that challenge, it is in a group:

{
    "legacyId": "30131098",
    "typeId": "c2579605-e294-4967-b3db-875ef85240cd",
    "legacy": {
        "track": "DEVELOP",
        "forumId": 110487,
        "directProjectId": 26597,
        "informixModified": "2020-06-25T07:38:25Z",
        "reviewType": "COMMUNITY",
        "reviewScorecardId": 30001031
    },
    "name": "Test Challenge 2 from TC Direct For V5_Groups_11",
    "description": "Test Marathon Match\nTest Marathon Match<br /><br /><h2>Final Submission Guidelines</h2>null",
    "descriptionFormat": "HTML",
    "projectId": 24115,
    "status": "Active",
    "created": "2020-06-25T07:04:22Z",
    "createdBy": "picachui",
    "updated": "2020-06-25T07:38:25Z",
    "updatedBy": "picachui",
    "timelineTemplateId": "6969125a-a12f-4b89-8de6-e66b0056f36b",
    "phases": [
        {
            "duration": 8434800,
            "scheduledEndDate": "2020-09-30T22:09:00.000Z",
            "isOpen": true,
            "name": "Registration",
            "phaseId": "a93544bc-c165-4af4-b55e-18f3593b457a",
            "actualStartDate": "2020-06-25T07:09:01.695Z",
            "id": "6a2e32a5-34f6-484b-b24a-869fef8dbe66",
            "scheduledStartDate": "2020-06-25T07:09:01.695Z"
        },
        {
            "duration": 11145300,
            "scheduledEndDate": "2020-11-01T07:18:00.000Z",
            "isOpen": true,
            "name": "Submission",
            "phaseId": "6950164f-3c5e-4bdc-abc8-22aaf5a1bd49",
            "actualStartDate": "2020-06-25T07:23:24.362Z",
            "id": "5dbf89fd-32db-4b36-8e2d-ee4862d87405",
            "scheduledStartDate": "2020-06-25T07:23:24.362Z"
        },
        {
            "duration": 172800,
            "scheduledEndDate": "2020-11-03T07:18:00.000Z",
            "isOpen": false,
            "name": "Review",
            "phaseId": "aa5a3f78-79e0-4bf7-93ff-b11e8f5b398b",
            "id": "5ede9b03-c6ff-48ac-bf4f-72147bb8faa3",
            "scheduledStartDate": "2020-11-01T07:18:00.000Z"
        }
    ],
    "terms": [
        {
            "roleId": "3eedd4a4-3c68-4f68-8de4-a1ca5c2055e5",
            "id": "e3370508-a541-4b9c-b83f-3bad33dcca4c"
        },
        {
            "roleId": "318b9c07-079a-42d9-a81f-b96be1dc1099",
            "id": "e3370508-a541-4b9c-b83f-3bad33dcca4c"
        },
        {
            "roleId": "732339e7-8e30-49d7-9198-cccf9451e221",
            "id": "9ef9dec4-dddb-48c9-9cce-659db68bc5ac"
        },
        {
            "roleId": "ff556573-5da6-4392-b38c-08c1d7599c4a",
            "id": "e3370508-a541-4b9c-b83f-3bad33dcca4c"
        },
        {
            "roleId": "d663fc84-5c37-43d1-a537-793feffb7667",
            "id": "e3370508-a541-4b9c-b83f-3bad33dcca4c"
        },
        {
            "roleId": "e0544b94-6420-4afc-8f63-238eddc751b9",
            "id": "e3370508-a541-4b9c-b83f-3bad33dcca4c"
        },
        {
            "roleId": "0e9c6879-39e4-4eb6-b8df-92407890faf1",
            "id": "aaa50b65-fb27-44e1-8398-03d70ce4ac5a"
        },
        {
            "roleId": "cfe12b3f-2a24-4639-9d8b-ec86726f76bd",
            "id": "11ad4ba8-c3ec-4cf9-98e6-c7f43a5bd89f"
        }
    ],
    "startDate": "2020-06-25T07:09:01.695Z",
    "numOfSubmissions": 2,
    "numOfRegistrants": 2,
    "endDate": "2020-11-03T07:18:00Z",
    "prizeSets": [
        {
            "prizes": [
                {
                    "type": "USD",
                    "value": 0
                },
                {
                    "type": "USD",
                    "value": 0
                }
            ],
            "description": "Challenge Prizes",
            "type": "placement"
        }
    ],
    "tags": [
        "Ab Initio",
        "Cisco"
    ],
    "groups": [
        "84daadca-dfc3-4ee2-8a69-5b67d8e449f7"
    ],
    "metadata": [
        {
            "name": "allowStockArt",
            "value": "false"
        }
    ],
    "events": [],
    "id": "d9b51702-711f-4ee4-93ab-5af4271e83f3",
    "numOfCheckpointSubmissions": 0,
    "submissions": [],
    "checkpoints": [],
    "type": "Marathon Match"
}

This call:
api.topcoder.com/v4/challenges?filter=id=30131098
returns nothing.

This call:
api.topcoder.com/v4/challenges/30131098
returns the challenge

{
    "id": "-3acc019a:1732d3f0032:-4ba",
    "result": {
        "success": true,
        "status": 200,
        "metadata": null,
        "content": {
            "subTrack": "DEVELOP_MARATHON_MATCH",
            "challengeTitle": "Test Challenge 2 from TC Direct For V5_Groups_11",
            "challengeId": 30131098,
            "projectId": 26597,
            "forumId": 110487,
            "detailedRequirements": "Test Marathon Match\nTest Marathon Match",
            "reviewScorecardId": 30001031,
            "numberOfCheckpointsPrizes": 0,
            "postingDate": "2020-06-25T07:09:01.695Z",
            "registrationEndDate": "2020-09-30T22:09:00.000Z",
            "submissionEndDate": "2020-11-01T07:18:00.000Z",
            "reviewType": "COMMUNITY",
            "forumLink": "https://apps.topcoder.com/forums/?module=Category&categoryID=110487",
            "appealsEndDate": "2020-11-03T07:18:00.000Z",
            "currentStatus": "Active",
            "challengeCommunity": "develop",
            "directUrl": "https://www.topcoder.com/direct/contest/detail.action?projectId=30131098",
            "prizes": [
                0.0,
                0.0
            ],
            "terms": [
                {
                    "termsOfUseId": 21303,
                    "role": "Submitter",
                    "agreeabilityType": "Electronically-agreeable",
                    "title": "Standard Terms for Topcoder Competitions v2.2",
                    "url": ""
                },
                {
                    "termsOfUseId": 20704,
                    "role": "Primary Screener",
                    "agreeabilityType": "Electronically-agreeable",
                    "title": "Standard Reviewer Terms v1.0",
                    "url": ""
                },
                {
                    "termsOfUseId": 20704,
                    "role": "Reviewer",
                    "agreeabilityType": "Electronically-agreeable",
                    "title": "Standard Reviewer Terms v1.0",
                    "url": ""
                },
                {
                    "termsOfUseId": 20704,
                    "role": "Aggregator",
                    "agreeabilityType": "Electronically-agreeable",
                    "title": "Standard Reviewer Terms v1.0",
                    "url": ""
                },
                {
                    "termsOfUseId": 20704,
                    "role": "Final Reviewer",
                    "agreeabilityType": "Electronically-agreeable",
                    "title": "Standard Reviewer Terms v1.0",
                    "url": ""
                },
                {
                    "termsOfUseId": 20794,
                    "role": "Manager",
                    "agreeabilityType": "Non-electronically-agreeable",
                    "title": "Approved OR Managers - TopCoder Technical Team",
                    "url": "http://www.topcoder.com"
                },
                {
                    "termsOfUseId": 20893,
                    "role": "Copilot",
                    "agreeabilityType": "Non-electronically-agreeable",
                    "title": "TopCoder Master Services Agreement",
                    "url": "http://www.topcoder.com/wiki/download/attachments/35129137/Member+Master+Agreement+v0020409.pdf"
                },
                {
                    "termsOfUseId": 20704,
                    "role": "Specification Reviewer",
                    "agreeabilityType": "Electronically-agreeable",
                    "title": "Standard Reviewer Terms v1.0",
                    "url": ""
                }
            ],
            "finalSubmissionGuidelines": "null",
            "technologies": [
                "Ab Initio"
            ],
            "platforms": [
                "Cisco"
            ],
            "currentPhaseName": "Submission",
            "currentPhaseRemainingTime": 9996532,
            "currentPhaseEndDate": "2020-11-01T07:18:00.000Z",
            "registrants": [
                {
                    "reliability": null,
                    "colorStyle": "color: #151516",
                    "registrationDate": "2020-06-25T07:22:56.000Z",
                    "submissionDate": "2020-07-06T06:55:04.000Z",
                    "handle": "lakshmiathreya"
                },
                {
                    "reliability": null,
                    "colorStyle": "color: #151516",
                    "registrationDate": "2020-06-27T04:54:03.000Z",
                    "handle": "CustomerUser"
                }
            ],
            "phases": [
                {
                    "duration": 8434800000,
                    "actualStartTime": "2020-06-25T07:09:01.695Z",
                    "scheduledStartTime": "2020-06-25T07:09:01.695Z",
                    "phaseId": 1359385,
                    "scheduledEndTime": "2020-09-30T22:09:00.000Z",
                    "fixedStartTime": "2020-06-24T13:00:00.000Z",
                    "type": "Registration",
                    "status": "Open"
                },
                {
                    "duration": 11145300000,
                    "actualStartTime": "2020-06-25T07:23:24.362Z",
                    "scheduledStartTime": "2020-06-25T07:23:24.362Z",
                    "phaseId": 1359386,
                    "scheduledEndTime": "2020-11-01T07:18:00.000Z",
                    "type": "Submission",
                    "status": "Open"
                },
                {
                    "duration": 172800000,
                    "scheduledStartTime": "2020-11-01T07:18:00.000Z",
                    "phaseId": 1359387,
                    "scheduledEndTime": "2020-11-03T07:18:00.000Z",
                    "type": "Review",
                    "status": "Scheduled"
                }
            ],
            "submissions": [
                {
                    "submitter": "lakshmiathreya",
                    "submitterId": 40911557,
                    "submissions": [
                        {
                            "finalScore": null,
                            "submissionId": 384094,
                            "submissionStatus": "Active",
                            "initialScore": null,
                            "placement": null,
                            "screeningScore": null,
                            "submissionTime": "2020-07-06T06:55:04.000Z"
                        },
                        {
                            "finalScore": null,
                            "submissionId": 382243,
                            "submissionStatus": "Active",
                            "initialScore": null,
                            "placement": null,
                            "screeningScore": null,
                            "submissionTime": "2020-06-27T03:59:27.000Z"
                        },
                        {
                            "finalScore": null,
                            "submissionId": 380733,
                            "submissionStatus": "Active",
                            "initialScore": null,
                            "placement": null,
                            "screeningScore": null,
                            "submissionTime": "2020-06-25T07:44:49.000Z"
                        }
                    ]
                }
            ],
            "checkpoints": [],
            "numberOfRegistrants": 2,
            "numberOfSubmissions": 3,
            "numberOfSubmitters": 1,
            "userDetails": {
                "roles": [],
                "hasUserSubmittedForReview": false,
                "winningPlacements": [],
                "submissions": []
            }
        }
    },
    "version": "v3"
}

All those requests are made with the challenge m2m in prod from postman.

I searched for that UUID in the submission logs, but I don't see anything. There's a chance the api restarted, but I don't believe it has.

@callmekatootie
Copy link
Contributor

This call:
api.topcoder.com/v4/challenges?filter=id=30131098
returns nothing.

This call:
api.topcoder.com/v4/challenges/30131098
returns the challenge

@rootelement

So, I see 2 issues here:

  1. The challenge api not returning data when we use ?filter=id=30131098 form
  2. The response from /challenges/:challengeId does not contain allPhases attribute.

I am not sure if this is an issue with the challenge api (version 4) or not.

  1. The query param ?filter=id=30131098 is something we have been using for long now. I am not sure if that is now obsolete and if we need to start using /challenges/:challengeId even for v4...
  2. If point 1 is true and that we need to start using /challenges/:challengeId format, then which attribute do we need to read from to get the phases. We currently read allPhases. The new response structure contains phases. Is that the equivalent of allPhases from the old structure?

@rootelement
Copy link
Contributor

If you add the filter param, it's pulling from ES. If you leave off the param, it's pulling from the db directly (dynamo?). I believe allPhases is a calculated param in ES?

cc: @cwdcwd

@lakshmiathreya
Copy link

@mtwomey @rootelement pls give us access to this Repo - 'lakshmiathreya' and 'SathyaJayabal'

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

No branches or pull requests

4 participants