goshippo / shippo-javascript-sdk

MIT License
7 stars 1 forks source link

Getting tracking info of (yet) unused tracking number fails validation #18

Closed Cyberuben closed 4 months ago

Cyberuben commented 5 months ago

Hi,

I'm attempting to get the tracking info of several parcels, and I know a lot of them might not have been used yet, or will never be used. Currently, I'm getting the following error tracking these parcels:

{
    "name": "SDKValidationError",
    "cause": {
        "issues": [
            {
                "code": "invalid_type",
                "expected": "string",
                "received": "undefined",
                "path": [
                    "tracking_history",
                    0,
                    "status_date"
                ],
                "message": "Required"
            }
        ],
        "name": "ZodError"
    },
    "rawValue": {
        "tracking_number": "<REDACTED>",
        "carrier": "ups",
        "servicelevel": {},
        "transaction": "<REDACTED>",
        "address_from": {
            "city": "<REDACTED>",
            "state": "<REDACTED>",
            "zip": "<REDACTED>",
            "country": "US"
        },
        "address_to": {
            "city": "<REDACTED>",
            "state": "<REDACTED>",
            "zip": "<REDACTED>",
            "country": "US"
        },
        "test": false,
        "tracking_history": [
            {
                "status_details": "Pre-Transit: Shipment information has been transmitted to the shipping carrier but it has not yet been scanned and picked up.",
                "object_created": "2024-05-06T11:37:39.842Z",
                "object_updated": "2024-05-06T11:37:39.842Z",
                "object_id": "<REDACTED>",
                "status": "UNKNOWN"
            }
        ],
        "messages": []
    }
}

The tracking history clearly mentions Pre-Transit, but the status there is UNKNOWN, that seems quite conflicted to me. This seems like either something that has to be fixed in the API response, or something that has to be fixed in the validation, because this seems like a perfectly valid state in tracking.

shippo-lueders commented 5 months ago

status_date is required according to our API specification. I'm checking with the team whether this is actually the case.

shippo-lueders commented 4 months ago

I've confirmed this is a bug and is actively being worked, I'll close this ticket once the fix has been released.

Cyberuben commented 4 months ago

Thanks for the quick responses the last few days!

shippo-lueders commented 4 months ago

quick update - this has been fixed but it doesn't look like it made yesterday's cutoff, should go out on Monday

Cyberuben commented 4 months ago

Any news on the fix yet? I'm still getting the same amount of API errors

shippo-lueders commented 4 months ago

I'm trying to track that down... I see the fix was merged but don't see it in the deployment logs, will update this ticket with an ETA later today

shippo-lueders commented 4 months ago

looks like it will be going out today, still not sure why it didn't go yesterday

Cyberuben commented 4 months ago

Sadly I'm still getting the same errors

shippo-lueders commented 4 months ago

apparently it isn't all the way fixed... I'm just going to update the client to not require status_date, at least until this issue gets resolved. you'll still get the status_details "Pre-Transit: Shipment..." and status "UNKNOWN" until the underlying issue is actually resolved, but at least the calls won't explode. I'll update this ticket once the fix is published.

shippo-lueders commented 4 months ago

https://www.npmjs.com/package/shippo/v/2.2.5 will fix the validation error you're getting.

I expect the tracking status fix to go out early next week, feel free to re-open if you're still getting wonky results

shippo-lueders commented 4 months ago

actually, something went wrong with publication, that package I linked was published two days ago, investigating

shippo-lueders commented 4 months ago

https://www.npmjs.com/package/shippo/v/2.2.6