Giter VIP home page Giter VIP logo

delivery-tracker's People

Contributors

bradlee96 avatar carstenschwede avatar egg- avatar mindsolve avatar nanthanwa avatar qcasey avatar shrinath-bidchat avatar zinthose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

delivery-tracker's Issues

Bad error handling and crash

In fedex.js line 101 looks like this

var results = parser.trace(body.TrackPackagesResponse.packageList);

and you do not handle the res correctly. request does not return error if the request response was actually an http error. and because of that you are not handling all error from the provider.

For example, fedex sometimes returns 403 with body null on multiple requests, which is a sync crash in line 101, meanwhile, it should return the error in res.

cb is not a function

Getting this every time I make a call for USPS:


          cb(tracker.error(e.message))
          ^

TypeError: cb is not a function

How do I solve it?

Here's my code:

const tracker = require('delivery-tracker')

const uspsCourier = tracker.courier( tracker.COURIER.USPS.CODE )

exports.upsTrackingNumber = async ( req, res ) =>
{
    let a = {}
    let { tracking_number } = req.body
    try {
        upsCourier.trace( { trace_number: tracking_number }, function (err, result) {
            if ( err ) { log( `err: `, err ) }
            console.log(result)
            res.json( result )
          } )
        
    } catch ( e ) {
        log( `upsTrackingNumber e: `, e )
        res.status( 400 ).json( { error: e } )
    }
}

Full error;

C:\Users\User\Desktop\project\backend\node_modules\delivery-tracker\lib\courier\usps.js:100
          cb(tracker.error(e.message))
          ^

TypeError: cb is not a function
    at Request._callback (C:\Users\User\Desktop\project\backend\node_modules\delivery-tracker\lib\courier\usps.js:100:11)
    at Request.self.callback (C:\Users\User\Desktop\project\backend\node_modules\request\request.js:185:22)
    at Request.emit (node:events:390:28)
    at Request.emit (node:domain:475:12)
    at Request.<anonymous> (C:\Users\User\Desktop\project\backend\node_modules\request\request.js:1154:10)
    at Request.emit (node:events:390:28)
    at Request.emit (node:domain:475:12)
    at IncomingMessage.<anonymous> (C:\Users\User\Desktop\project\backend\node_modules\request\request.js:1076:12)
    at Object.onceWrapper (node:events:509:28)
    at IncomingMessage.emit (node:events:402:35)
    at IncomingMessage.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Cannot run in browser (React code)

When attempting to track a FedEx package in my React code, I received:

POST https://www.fedex.com/trackingCal/track 403 (Forbidden)

And:

Access to fetch at 'https://www.fedex.com/trackingCal/track' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Is there any way to set the CORS mode to no-cors when running in a browser? Or was the module not meant to be used in a browser? Is the 403 error related, or incidental?

TypeScript typings

Hey! I think TypeScript typings would be very useful for me and other TypeScript users.

Thanks!

The delivery-tracker is not work with UPS.

Dear,
From 1 day ago. I see, our's library is not working for requests to UPS service to get tracking.
I was tested with the same tracking number on the UPS website that is response result ok. But that does not work with our system.
What happened with our's system? Did the UPS have any update and we out an update?
My test: with new version 2.7.0
delivery-tracker -c UPS 1Z4566F5NT41188xxx
Many Thanks

Canada Post Tracking

Just wondering if there's plan for adding Canada Post tracking.
They have "unofficial" JSON APIs for tracking multiple packages summary and single package details:

GET https://www.canadapost-postescanada.ca/track-reperage/rs/track/json/package?pins=
GET https://www.canadapost-postescanada.ca/track-reperage/rs/track/json/package/

Would love to take a look and help out or make a full request.

Acquiring Test Tracking Numbers

Hello,

Thanks for the great project, it’s really helping with a project that I’m working on. I’m interested in adding another courier to this, which I’m fully capable of doing myself, but I’m wondering how you go about getting test Tracking IDs to test with. I have a few parcels with this courier, but I doubt they could reach all needed test cases. Would I have any luck contacting the courier directly for this?

Courier: https://asendiausa.com

Questions on API limitations

This is just a functionality question but we're looking for a general purpose api for tracking shipments to integrate into our application. This packages is exactly what we were looking for. But have you found any limitations to the APIs you are hitting? ie Daily/Hourly frequency caps

Feature Request: Make library usable within browser

It would be useful to have this library available directly within the browser.
Has this been considered already? Are there any methods that can't be replicated in the browser?

Based on a quick skim I would imagine that replacing request and require with corresponding fetch calls might be sufficient. (Other option would be to rollup all require calls for the courier inclusions in one chunk)

USPS no longer working

I'm using version 2.7.2 with USPS tracking numbers, even if valid on the USPS website seem to only return the response
{ code: 10, message: 'invalid trace number.' }

The issue started seemingly 2022-09-19 and continues to this morning. Perhaps there is a change or restriction upstream?

modernize module (move to ts and change deprecated deps)

some things to do with this project to modernize it:

  • convert to typescript to benefit from intellisense and autocomplete in IDEs
  • replace request library with axios since request is depracated

I can open a PR to do the following changes, but since it's a big change, I want to check with the author that this is something that he wants to change. If you guys do want this, I'll open a PR to fix both issues

Feature Request: Return raw response for custom parsing

First of all, thankyou for creating this package. It has helped me tons. I only require Fedex tracking and fedex docs are super confusing, so this has been a lifesaver.

I'd like to request a feature to return raw response for tracking. For eg; Fedex gives tons of data about shipment but the returned data is just an array of 'scans'. It'd be useful if we could set a flag to return all data.

UPS not working

Looks like the response here says:

The response body for the UPS request is: body: '{"unauthorized":401}'

UPS invalid dates

All of the result.checkpoints.time fields returned by UPS are set to 'Invalid Date'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.