sendgrid-rest is a lightweight, generalized HTTP REST client library designed for Node.js environments. It provides a simplified, callback-based interface for making HTTP requests to any RESTful or RESTful-like API, abstracting away some of Node.js's native `http`/`https` module complexities. The package is currently at version 2.6.1, with the last release dating back to March 2020. Releases have been infrequent and focused on maintenance, documentation, and minor dependency updates (TypeScript type definitions were added in v2.6.0). This library is explicitly *not* the official SendGrid API client; for SendGrid-specific interactions, users are directed to the `@sendgrid/client` package. Its core design uses traditional CommonJS modules and callback patterns, reflecting its age, and it officially supported very old Node.js versions (0.10, 0.12, 4).
npm install sendgrid-restVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to make a POST request to a hypothetical REST API, including setting headers, query parameters, and a JSON request body using the callback-based API.
Migrate your usage to the `@sendgrid/client` package, which offers a Promise-based API and is actively maintained. Install with `npm install @sendgrid/client`.
It is strongly recommended to migrate to a modern, actively maintained HTTP client library (like `axios`, `node-fetch`, or `@sendgrid/client`) that explicitly supports your Node.js version. If forced to use, thoroughly test against your target Node.js runtime.
Consider migrating to an HTTP client that offers native Promise support for better async control and cleaner code with `async/await`. Manual promisification is possible but adds boilerplate.
If using SendGrid's email service, ensure your SendGrid account is on a paid plan to continue sending emails. This warning is specific to SendGrid API usage, not the `sendgrid-rest` library itself.
Ensure you are using `const Client = require('sendgrid-rest').Client;` in CommonJS contexts. If using TypeScript with `esModuleInterop` enabled, configure your `tsconfig.json` or adjust import paths. For modern applications, migrating to `@sendgrid/client` or another ESM-compatible HTTP client is recommended.Update your Node.js environment to a more recent, officially supported LTS version. Ensure your system's certificate authorities are up to date. If behind a corporate proxy, configure Node.js to trust the proxy's certificates (`NODE_TLS_REJECT_UNAUTHORIZED=0` is a workaround but insecure for production).
Verify `request.host` and `request.path` are correct. Check network connectivity to the target API. Inspect server logs if you control the API. Implement robust error handling within the callback function and consider adding manual timeouts if the client doesn't provide them.
No dependency data recorded yet.