jsreport-client is a Node.js remote client library designed to interact with a jsreport server, facilitating programmatic report generation and management of jsreport entities. It acts as a wrapper around the jsreport REST API, abstracting HTTP communication to allow developers to render PDF reports, work with templates, and manage data from a Node.js application. The package is currently at version 1.2.1, with its last update in March 2021. Releases are infrequent, suggesting it is in a maintenance phase rather than active feature development. Key differentiators include its promise-based API for rendering and its seamless integration with remote jsreport instances, supporting both on-premise servers and the jsreportonline SaaS offering. It handles request retry mechanisms and error reporting, providing a robust interface for report automation.
npm install jsreport-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to initialize the jsreport client and render a PDF report using a simple Handlebars template and data, saving the output to a file.
Update all `client.render()` calls to use `await` or `.then()` for Promise-based handling. Review the jsreport v2 migration guide for other potential breaking changes in the server-side API.
Review any custom HTTP client configurations passed to `jsreport-client` and adapt them to `axios` compatible options. Ensure network proxies or certificate handling configured for `request` are correctly translated for `axios`.
Avoid `strictSSL:false` in production environments. For self-signed certificates, properly configure your Node.js environment with the trusted CA certificate. Use environment variables to conditionally set `strictSSL` for development vs. production (e.g., `strictSSL: process.env.NODE_ENV === 'production'`).
Monitor memory usage on both the client and jsreport server when dealing with very large report payloads. Ensure the jsreport server itself is configured to handle large requests efficiently.
For jsreport v3+ servers, consider migrating to `@jsreport/nodejs-client` (install via `npm i @jsreport/nodejs-client`). If sticking with `jsreport-client` (v1.x), ensure your jsreport server is running a compatible v2 version.
Verify that your jsreport server is running and listening on `http://localhost:5488` (or the configured `serverUrl`). Check firewall rules or network connectivity. The `jsreport-cli` can be used to start a local server.
If in a development environment and the certificate is intentionally self-signed, initialize the client with `strictSSL: false`. For production, ensure the client's Node.js environment trusts the server's SSL certificate by adding the CA to the system's trusted certificates or specifying a custom `ca` option if supported by the client.
Ensure you are importing and initializing the client factory function correctly: `import Client from 'jsreport-client'; const client = Client({ serverUrl: '...' });`. Double-check the package name in `package.json` to confirm it's `jsreport-client`.