Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-informative error message when API key is missing or incorrect #231

Open
vitalir-xops opened this issue May 24, 2024 · 0 comments
Open

Comments

@vitalir-xops
Copy link

When the auth key is invalid the sdk throws a generic exception with non-informative error message which makes these kind of errors hard to catch.

Version: "shipengine": "^1.0.7",

Code example:

import { ShipEngine } from "shipengine";
const config = {
  apiKey: "TEST",
}

const addresses = [
  {
    name: "John Smith",
    companyName: "ShipStation",
    addressLine1: "3800 N Lamar Blvd",
    addressLine2: "#220",
    cityLocality: "Austin",
    stateProvince: "TX",
    postalCode: "78756",
    countryCode: "US",
    addressResidentialIndicator: "no",
  },
]
let shipengine = new ShipEngine(config);
const result = await shipengine.validateAddresses(addresses);

error message:

Error validating address:  response.map is not a function
Error validating address:  TypeError: response.map is not a function
    at Object.formatResponse (<path>/node_modules/shipengine/cjs/validate-addresses/format-response.js:5:21)
    at Object.validateAddresses (<path>/node_modules/shipengine/cjs/validate-addresses/index.js:19:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async validateAddresses (<path>/agent.js:20:20)
    ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant