egg- / delivery-tracker Goto Github PK
View Code? Open in Web Editor NEWdelivery tracking library for Node.js
License: MIT License
delivery tracking library for Node.js
License: MIT License
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.
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)
For some reason the UPS endpoint returns a 401 error when trying to use this module from within an electron application.
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?
Do all of the carriers use the official apis?
Hey! I think TypeScript typings would be very useful for me and other TypeScript users.
Thanks!
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
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.
It has worked in the past, but recently the Fedex tracker always returns a 403 forbidden error. Maybe Fedex restricted access to https://www.fedex.com/trackingCal/track URL. I don't know if there is an easy workaround.
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
Here is a simple tracking number to test.
1Z2EE9401223016758
.
It is delivered, but it shows status "InTransit"
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
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)
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?
Support for Emirates post
some things to do with this project to modernize it:
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
First off, thank you for creating this repo, it has been awesome! Recently USPS has not been working, here is an example tracking number:
https://tools.usps.com/go/TrackConfirmAction.action?tLabels=9400111206217036095304
9400111206217036095304
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.
Looks like the response here says:
The response body for the UPS request is: body: '{"unauthorized":401}'
All of the result.checkpoints.time
fields returned by UPS are set to 'Invalid Date'
.
Confirmed it is an issue with this package as removing it results in Lambda successfully executing. However, keeping it in causes the above error. Any support would be appreciated,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.