{"id":15573,"library":"clearbit","title":"Clearbit Node.js Client","description":"The `clearbit` Node.js client (`clearbit-node`) provides an interface for interacting with various Clearbit business intelligence APIs, including Enrichment, Discovery, and Watchlist. It allows developers to programmatically look up person and company data by email or domain, and perform prospector searches. The library, last updated with version `1.3.5` eight years ago, primarily uses CommonJS modules and a Promise-based API for handling asynchronous operations and specific Clearbit API errors like `QueuedError` and `NotFoundError`. Due to its age and lack of maintenance, it does not natively support modern JavaScript features like ESM and may have unmaintained dependencies, making it potentially unsuitable for new projects or environments requiring up-to-date security patches. No new releases are expected.","status":"abandoned","version":"1.3.5","language":"javascript","source_language":"en","source_url":"https://github.com/clearbit/clearbit-node","tags":["javascript","clearbit","client","email"],"install":[{"cmd":"npm install clearbit","lang":"bash","label":"npm"},{"cmd":"yarn add clearbit","lang":"bash","label":"yarn"},{"cmd":"pnpm add clearbit","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary way to initialize the client in CommonJS. Direct ESM import is not supported.","wrong":"import clearbit from 'clearbit';","symbol":"clearbit","correct":"const clearbit = require('clearbit')(process.env.CLEARBIT_API_KEY);"},{"note":"Accesses the Client constructor directly for alternative initialization. CommonJS only.","wrong":"import { Client } from 'clearbit';","symbol":"Client","correct":"const Client = require('clearbit').Client;"},{"note":"API modules like Person, Company, etc., are accessed as properties of the initialized client instance, not directly from the package root.","wrong":"const Person = require('clearbit').Person;","symbol":"Person","correct":"const { Person } = clearbit;"}],"quickstart":{"code":"const clearbit = require('clearbit')(process.env.CLEARBIT_API_KEY ?? '');\n\nif (!process.env.CLEARBIT_API_KEY) {\n  console.error('ERROR: CLEARBIT_API_KEY environment variable is not set.');\n  process.exit(1);\n}\n\nconst Person = clearbit.Person;\nconst Company = clearbit.Company;\n\nasync function lookupData() {\n  try {\n    console.log('--- Looking up Person ---');\n    const person = await Person.find({ email: 'alex@clearbit.com' });\n    console.log('Person Name:', person.name.fullName);\n    console.log('Person Title:', person.employment.title);\n  } catch (err) {\n    if (err instanceof Person.QueuedError) {\n      console.log('Person lookup queued:', err.message);\n    } else if (err instanceof Person.NotFoundError) {\n      console.log('Person not found:', err.message);\n    } else {\n      console.error('Error looking up person:', err.message);\n    }\n  }\n\n  try {\n    console.log('\\n--- Looking up Company ---');\n    const company = await Company.find({ domain: 'clearbit.com' });\n    console.log('Company Name:', company.name);\n    console.log('Company Sector:', company.category.sector);\n  } catch (err) {\n    if (err instanceof Company.QueuedError) {\n      console.log('Company lookup queued:', err.message);\n    } else if (err instanceof Company.NotFoundError) {\n      console.log('Company not found:', err.message);\n    } else {\n      console.error('Error looking up company:', err.message);\n    }\n  }\n}\n\nlookupData();","lang":"javascript","description":"Demonstrates initializing the Clearbit client using an API key from environment variables, and performing basic lookups for a person by email and a company by domain, including specific error handling for Clearbit's `QueuedError` and `NotFoundError`."},"warnings":[{"fix":"Consider migrating to Clearbit's newer API versions directly via an HTTP client or seeking alternative, actively maintained libraries if available. Clearbit's API documentation should be consulted for direct integration options.","message":"This package (`clearbit@1.3.5`) is abandoned and has not been updated in over eight years. It is highly recommended to avoid using it in new projects due to potential security vulnerabilities from outdated dependencies, lack of bug fixes, and compatibility issues with modern Node.js runtimes.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your project is configured for CommonJS, or use a bundler that can transpile CommonJS to ESM if necessary. For modern Node.js, stick to `require()` or use a different library.","message":"The library is exclusively CommonJS (`require`) and does not support ES Modules (`import`) directly. Attempting to use `import` syntax will result in errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always use `instanceof` to catch specific Clearbit errors, as demonstrated in the quickstart. Be aware that the Promise implementation might not be fully compliant with modern Promise A+ specifications, which could lead to unexpected behavior in complex asynchronous flows.","message":"Error handling relies on custom error classes (e.g., `Person.QueuedError`, `Company.NotFoundError`) which might not behave as expected or integrate seamlessly with standard `try/catch` blocks without explicit `instanceof` checks. This pattern is common in older Promise libraries like Bluebird, which may differ from native Promises.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure `process.env.CLEARBIT_API_KEY` is set before the module is `require`d. For more dynamic scenarios, use `new Client({ key: 'api_key' })` after `const Client = require('clearbit').Client;` to instantiate with a runtime-provided key.","message":"The client is designed for synchronous API key initialization upon `require('clearbit')`, which can be problematic for dynamic API key management or serverless functions where environment variables might not be immediately available during module loading.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Change your file to a CommonJS context (e.g., `.js` file without `type: 'module'`) or use a bundler that transpiles CJS. This package is CJS-only.","cause":"Attempting to use `require()` in an ES Module context (`type: 'module'` in package.json or `.mjs` file).","error":"ReferenceError: require is not defined in ES module scope"},{"fix":"Ensure `require('clearbit')('YOUR_API_KEY')` has a valid key string, or when using `new Client({ key: 'YOUR_API_KEY' })`, that the `key` property is set.","cause":"The API key was not provided during client initialization.","error":"Error: Missing Clearbit API Key"},{"fix":"Ensure you are using `require('clearbit')(API_KEY)` for the initial factory function call, or `const Client = require('clearbit').Client; new Client({ key: API_KEY });` for the constructor.","cause":"You might be trying to call `clearbit()` after already initializing it once, or attempting to use `clearbit.Client` incorrectly.","error":"TypeError: clearbit(...) is not a function"},{"fix":"Always attach a `.catch()` block to your Promise chains or use `try...catch` with `async/await` to handle all possible errors, including Clearbit's custom error types.","cause":"Failure to catch rejections from the API calls, especially `QueuedError` or `NotFoundError` if not explicitly handled.","error":"UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch()."}],"ecosystem":"npm"}