Skip to content

Authentication Issues

Invalid Credentials → BigshipAuthError (HTTP 401)

Section titled “Invalid Credentials → BigshipAuthError (HTTP 401)”

If you receive a BigshipAuthError with HTTP status 401, your clientId or clientSecret is incorrect.

import { BigshipClient, BigshipAuthError } from "bigship-sdk";
try {
const client = new BigshipClient({
clientId: process.env.BIGSHIP_CLIENT_ID,
clientSecret: process.env.BIGSHIP_CLIENT_SECRET,
});
} catch (err) {
if (err instanceof BigshipAuthError) {
console.error("Authentication failed:", err.message);
}
}
  • Verify your credentials in the Bigship dashboard.
  • Ensure no trailing whitespace in environment variables.

The SDK auto-refreshes tokens before expiry. If you still hit auth errors under load, adjust tokenTtlMs:

const client = new BigshipClient({
clientId: process.env.BIGSHIP_CLIENT_ID,
clientSecret: process.env.BIGSHIP_CLIENT_SECRET,
tokenTtlMs: 50 * 60 * 1000, // 50 minutes (default is 55 minutes)
});

Setting tokenTtlMs lower than the server-side expiry forces more frequent refreshes.

Ensure the baseURL matches your Bigship account region:

const client = new BigshipClient({
clientId: process.env.BIGSHIP_CLIENT_ID,
clientSecret: process.env.BIGSHIP_CLIENT_SECRET,
baseURL: "https://apiv2.bigship.in", // India region
});

Check your account settings for the correct regional endpoint.

Firewall / Network Issues → BigshipNetworkError

Section titled “Firewall / Network Issues → BigshipNetworkError”

If requests fail before reaching the server, you may receive a BigshipNetworkError:

import { BigshipNetworkError } from "bigship-sdk";
try {
await client.createOrder(orderPayload);
} catch (err) {
if (err instanceof BigshipNetworkError) {
console.error("Network error:", err.message);
// err.statusCode will be -1 for connection-level failures
}
}
  • Whitelist *.bigship.in domains in your firewall.
  • If behind a corporate proxy, see Network Errors.