sw-tools / checkin-service

Checks the user in to a flight
MIT License
9 stars 3 forks source link

Circular JSON structure error #1

Closed waffle267 closed 2 years ago

waffle267 commented 2 years ago

I gave this project a spin a couple of days ago, and it looks like it ran into an issue in makeFetchCheckinDataAttempts. It tried once, received an error, and then it looks like it threw an error and stopped (so I went ahead and checked into my flight manually).

I deployed it to AWS Lambda per the README - happy to share any other information that may be helpful. This is a cool project, thanks for sharing this!

INFO Starting fetch checkin data attempts at December 31, 2021, XX:XX:XX PM UTC
INFO failed on attempt 1 of 80 at December 31, 2021, XX:X:XX PM UTC with error {
    "name": "HTTPError",
    "code": "ERR_NON_2XX_3XX_RESPONSE",
    "timings": {
        "phases": {
            "wait": 1,
            "dns": 98,
            "tcp": 10,
            "tls": 10,
            "request": 0,
            "firstByte": 740,
            "download": 3,
            "total": 862
        }
    }
}
ERROR TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'TLSSocket'
    |     property '_httpMessage' -> object with constructor 'ClientRequest'
    --- property 'socket' closes the circle
    at JSON.stringify (<anonymous>)
    at handleInternal (/var/task/src/handlers/handle-scheduled-checkin.js:74:66)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Runtime.handle [as handler] (/var/task/src/handlers/handle-scheduled-checkin.js:43:18)
ERROR Invoke Error  {
    "errorType": "TypeError",
    "errorMessage": "Converting circular structure to JSON\n    --> starting at object with constructor 'TLSSocket'\n    |     property '_httpMessage' -> object with constructor 'ClientRequest'\n    --- property 'socket' closes the circle",
    "stack": [
        "TypeError: Converting circular structure to JSON",
        "    --> starting at object with constructor 'TLSSocket'",
        "    |     property '_httpMessage' -> object with constructor 'ClientRequest'",
        "    --- property 'socket' closes the circle",
        "    at JSON.stringify (<anonymous>)",
        "    at handleInternal (/var/task/src/handlers/handle-scheduled-checkin.js:74:66)",
        "    at processTicksAndRejections (internal/process/task_queues.js:95:5)",
        "    at async Runtime.handle [as handler] (/var/task/src/handlers/handle-scheduled-checkin.js:43:18)"
    ]
}
swtools0 commented 2 years ago

Thanks so much for your contribution! I apologize for the problem. Hoping that PR #2 fixes this.