Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

[$40] Error when creating new project in dev #448

Closed
jmgasper opened this issue May 20, 2022 · 19 comments
Closed

[$40] Error when creating new project in dev #448

jmgasper opened this issue May 20, 2022 · 19 comments

Comments

@jmgasper
Copy link
Collaborator

This error is seen when using jcori to create a new project in dev, targeting a Github repo that is owned by myself. jcori currently has a Github token that matches my account on Github, so there should be no reason this fails.
Screen Shot 2022-05-20 at 4 09 07 pm

@jmgasper
Copy link
Collaborator Author

Challenge https://www.topcoder.com/challenges/999f2f67-d774-4a44-a686-9b249eb2726b has been created for this ticket.

This is an automated message for ghostar via Topcoder X

@52cs 52cs self-assigned this May 20, 2022
@jmgasper
Copy link
Collaborator Author

Challenge https://www.topcoder.com/challenges/999f2f67-d774-4a44-a686-9b249eb2726b has been assigned to 52code.

This is an automated message for ghostar via Topcoder X

@jmgasper
Copy link
Collaborator Author

@52cs - Any update on this one?

@52cs
Copy link
Collaborator

52cs commented May 24, 2022 via email

@jmgasper
Copy link
Collaborator Author

@52cs - Ok, great, thanks! If you want to update any documentation to help get other folks set up in the future, I'm happy to pay you for that work as well - just shoot me an email to discuss, thanks!

@52cs
Copy link
Collaborator

52cs commented May 24, 2022 via email

@52cs
Copy link
Collaborator

52cs commented May 24, 2022

It seems that the setting of github's above is correct.
The problem is the github-api: 503 error ?!
{"message":"Failed to ensure valid owner user. InnerError: Error: 503 error making request get https://api.github.com/user: "Service Unavailable". 503 error making request get https://api.github.com/user: "Service Unavailable".\n","code":"Service Unavailable"}

@52cs
Copy link
Collaborator

52cs commented May 24, 2022

@jmgasper
jcori has administrator role.
Do you have non-admin role test user?

@jmgasper
Copy link
Collaborator Author

@52cs - Sure, here are a couple:

  • Ghostar / appirio123
  • TCConnCopilot / Appirio123

@52cs
Copy link
Collaborator

52cs commented May 25, 2022

@52cs - Sure, here are a couple:

  • Ghostar / appirio123
  • TCConnCopilot / Appirio123

@jmgasper
I have tested with the non-admin account. It is OK.

Because the challenge cannot be created by the topcoder-x-processor successfully in my local env. I have not test the related part. Please help test it.

About my local topcoder-x-processor env setting.
I could confirm that the Auth0 has been configured correctly.
I can use postman with the throw out request data from topcoder-x-processor, the postman can create the challenge successfully.
But the topcoder-x-processor always failed with Error 400: Bad request. Request parameters were invalid.
The params cannot pass Joi in the challenge api server side.

Hope you can figure out what is the problem of my local setting :)

PS. the throw out data from topcoder-x-processor (with token replaced by x.xx.xxx):

 Error: 'Failed to create challenge.', Details: {"message":"Request failed with status code 400","name":"Error","stack":"Error: Request failed with status code 400\n    at createError (/home/jim/project/topcoder-x/dev/topcoder-x-processor/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/home/jim/project/topcoder-x/dev/topcoder-x-processor/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/home/jim/project/topcoder-x/dev/topcoder-x-processor/node_modules/axios/lib/adapters/http.js:237:11)\n    at emitNone (events.js:111:20)\n    at IncomingMessage.emit (events.js:208:7)\n    at endReadableNT (_stream_readable.js:1064:12)\n    at _combinedTickCallback (internal/process/next_tick.js:139:11)\n    at process._tickDomainCallback (internal/process/next_tick.js:219:9)","config":{"url":"https://api.topcoder-dev.com/v5/challenges","method":"post","data":"{\"status\":\"Draft\",\"typeId\":\"ecd58c69-238f-43a4-a4bb-d172719b9f31\",\"name\":\"without label\",\"description\":\"[$100] without label\",\"prizeSets\":[{\"type\":\"placement\",\"prizes\":[{\"type\":\"USD\",\"value\":100}]}],\"timelineTemplateId\":\"53a307ce-b4b3-4d6f-b9a1-3741a58f77e6\",\"projectId\":20676,\"trackId\":\"9b6fc876-f4d9-4ccb-9dfd-419247628825\",\"legacy\":{\"pureV5Task\":true},\"startDate\":\"2022-05-25T03:40:33.073Z\"}","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","authorization":"Bearer x.xx.xxx","User-Agent":"axios/0.19.0","Content-Length":394,"host":"api.topcoder-dev.com"},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1}}
error: Challenge creation failure: ProcessorError: Failed to create challenge.
debug: Scheduling event for next retry
error: Error happened in handleEventGracefully
ProcessorError: Failed to create challenge.
    at Object.convertTopcoderApiError (/home/jim/project/topcoder-x/dev/topcoder-x-processor/utils/errors.js:81:20)
    at Object.createChallenge (/home/jim/project/topcoder-x/dev/topcoder-x-processor/utils/topcoder-api-helper.js:215:18)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:229:7)
debug: Scheduling event for next retry
error:  message=Failed to create challenge., stack=ProcessorError: Failed to create challenge.
    at Object.convertTopcoderApiError (/home/jim/project/topcoder-x/dev/topcoder-x-processor/utils/errors.js:81:20)
    at Object.createChallenge (/home/jim/project/topcoder-x/dev/topcoder-x-processor/utils/topcoder-api-helper.js:215:18)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:229:7), name=ProcessorError, statusCode=400, errorAt=topcoder, logged=true

@jmgasper
Copy link
Collaborator Author

Can you capture what's being sent in the POST to the challenge endpoint? That may help identify where the problem is, thanks!

@52cs
Copy link
Collaborator

52cs commented May 25, 2022

Post body copies from throw log:

{"status":"Draft","typeId":"ecd58c69-238f-43a4-a4bb-d172719b9f31","name":"m2m token problem?","description":"[$40] m2m token problem?","prizeSets":[{"type":"placement","prizes":[{"type":"USD","value":40}]}],"timelineTemplateId":"53a307ce-b4b3-4d6f-b9a1-3741a58f77e6","projectId":20673,"trackId":"9b6fc876-f4d9-4ccb-9dfd-419247628825","legacy":{"pureV5Task":true},"startDate":"2022-05-25T03:20:01.218Z"}

Sent in postman with path and token, success:

{
    "id": "08c63765-4c92-444e-8d94-d73a7815944a",
    "created": "2022-05-25T10:15:34.993Z",
    "createdBy": "tcwebservice",
    "updated": "2022-05-25T10:15:34.993Z",
    "updatedBy": "tcwebservice",
    "status": "Draft",
    "typeId": "ecd58c69-238f-43a4-a4bb-d172719b9f31",
    "name": "m2m token problem?",
    "description": "[$40] m2m token problem?",
    "prizeSets": [
        {
            "type": "placement",
            "prizes": [
                {
                    "type": "USD",
                    "value": 40
                }
            ]
        }
    ],
    "timelineTemplateId": "53a307ce-b4b3-4d6f-b9a1-3741a58f77e6",
    "projectId": 20673,
    "trackId": "9b6fc876-f4d9-4ccb-9dfd-419247628825",
    "legacy": {
        "pureV5Task": true,
        "reviewType": "INTERNAL",
        "confidentialityType": "public",
        "directProjectId": 29433
    },
    "startDate": "2022-05-25T03:20:01.218Z",
    "task": {
        "isTask": true,
        "isAssigned": false,
        "memberId": null
    },
    "phases": [
        {
            "phaseId": "a93544bc-c165-4af4-b55e-18f3593b457a",
            "duration": 864000,
            "id": "e6b3f908-0d00-409e-94bc-d5b896d87602",
            "name": "Registration",
            "isOpen": false,
            "scheduledStartDate": "2022-05-25T03:20:01.218Z",
            "scheduledEndDate": "2022-06-04T03:20:01.218Z",
            "actualStartDate": "2022-05-25T03:20:01.218Z"
        },
        {
            "phaseId": "6950164f-3c5e-4bdc-abc8-22aaf5a1bd49",
            "duration": 864000,
            "id": "53f80ab0-06e7-4f28-af69-3a913c11e9c1",
            "name": "Submission",
            "isOpen": false,
            "scheduledStartDate": "2022-05-25T03:20:01.218Z",
            "scheduledEndDate": "2022-06-04T03:20:01.218Z",
            "actualStartDate": "2022-05-25T03:20:01.218Z"
        },
        {
            "phaseId": "003a4b14-de5d-43fc-9e35-835dbeb6af1f",
            "duration": 86400,
            "id": "ca2bed9f-3183-4f10-8d4e-26a9a106c094",
            "name": "Iterative Review",
            "isOpen": false,
            "predecessor": "6950164f-3c5e-4bdc-abc8-22aaf5a1bd49",
            "scheduledStartDate": "2022-06-04T03:20:01.218Z",
            "scheduledEndDate": "2022-06-05T03:20:01.218Z",
            "actualStartDate": "2022-06-04T03:20:01.218Z"
        }
    ],
    "terms": [],
    "descriptionFormat": "markdown",
    "endDate": "2022-06-05T03:20:01.218Z",
    "overview": {
        "totalPrizes": 40
    },
    "numOfSubmissions": 0,
    "numOfRegistrants": 0,
    "currentPhaseNames": [],
    "registrationStartDate": "2022-05-25T03:20:01.218Z",
    "registrationEndDate": "2022-06-04T03:20:01.218Z",
    "submissionStartDate": "2022-05-25T03:20:01.218Z",
    "submissionEndDate": "2022-06-04T03:20:01.218Z",
    "track": "Development",
    "type": "Task"
}

But topcode-x-processor throw out say Error 400: params invalid. Validation of Joi not passed?

I'm not sure it is easy or not to set up challenge-api locally. I will try it or other attempts latter.

@jmgasper
Copy link
Collaborator Author

@52cs - I can't seem to figure this out either. Is there any additional debugging you can pull? Can you see the full response from the challenge API in TCX and not Postman?

@52cs
Copy link
Collaborator

52cs commented May 26, 2022

@jmgasper

It is not easy to see the full response error.

Request:

const url = 'https://api.topcoder-dev.com/v5/challenges';
axios.post(url, body, header).then(res => console.log(res)).catch(err => console.log(err));

Response.data:

data: '<html>\r\n<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n<center>The plain HTTP request was sent to HTTPS port</center>\r\n</body>\r\n</html>\r\n' } }

And when I change https to http, the request success.
But by using postman, both http and https can success.
Do you know why?

By using http://api.topcoder-dev.com/v5/challenges instead of https://api.topcoder-dev.com/v5/challenges,
My local TCX can create the challenge successfully now.

@52cs
Copy link
Collaborator

52cs commented May 26, 2022

@jmgasper
It is the problem of my proxy. My proxy use http forward all request.
When I turn off proxy, both http and https request works success.
(But with proxy on, both postman and curl can success with https request, only axios failed...)

But mfe-customer-work use the same post to create challenge, it can success with my http proxy on.
The difference between them should be setting, I use tc-auth-lib to help mfe-customer-work login successfully, but topcoder-x-processor do not need login, so does not use tc-auth-lib. This is the only difference.

Can you explain the reason behind them? I lack of network knowledge indeed...

@jmgasper
Copy link
Collaborator Author

@52cs Interesting, that's very strange. I'm not sure what the exact issue would be, but I'm glad it's resolved. Does that help get further on the original issue?

@52cs
Copy link
Collaborator

52cs commented May 27, 2022

@jmgasper
Because the create payment page cannot display project to select, I have not tested payments.
Other parts look good. Please have a review.

I can help to fix the payment page, if needed.

@jmgasper
Copy link
Collaborator Author

@52cs - Thanks - will be reviewing today or tomorrow

jmgasper added a commit that referenced this issue May 30, 2022
@jmgasper
Copy link
Collaborator Author

Payment task has been updated: https://www.topcoder.com/challenges/999f2f67-d774-4a44-a686-9b249eb2726b
Payments Complete
Winner: 52code
Challenge 999f2f67-d774-4a44-a686-9b249eb2726b has been paid and closed.

This is an automated message for ghostar via Topcoder X

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

No branches or pull requests

2 participants