{"id":15716,"library":"netsuite-api-client","title":"NetSuite API Client","description":"The `netsuite-api-client` package provides a robust interface for interacting with NetSuite's SuiteTalk Web Services, specifically focusing on REST calls and SuiteQL queries. It is currently at stable version `1.0.3` and demonstrates an active release cadence with frequent patch updates addressing dependencies and minor fixes. This library distinguishes itself as a direct fork and merge of the formerly popular `netsuite-rest` and `suiteql` packages, specifically designed to address their limitations. Key differentiators include its ESM-only nature, comprehensive TypeScript typings, and the integration of updated dependencies like `got` to mitigate recent CVEs. It is explicitly maintained and supported, offering a more modern and secure alternative for NetSuite integrations. The package supports promise-based operations for standard REST `request` calls and `query` executions, along with a `queryAll` streaming mechanism for efficiently handling large datasets, which is crucial for enterprise-level data operations. Error handling has also been significantly improved to directly surface NetSuite-specific messages.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/julbrs/netsuite-api-client","tags":["javascript","netsuite","suitetalk","rest","web","services","promise","suiteql","typescript"],"install":[{"cmd":"npm install netsuite-api-client","lang":"bash","label":"npm"},{"cmd":"yarn add netsuite-api-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add netsuite-api-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core HTTP client for making requests, frequently updated for security and features.","package":"got","optional":false}],"imports":[{"note":"This package is ESM-only since v1.0.0. CommonJS `require` statements will fail. Projects must be configured for ESM or use dynamic `import()`.","wrong":"const NetsuiteApiClient = require('netsuite-api-client');","symbol":"NetsuiteApiClient","correct":"import { NetsuiteApiClient } from 'netsuite-api-client';"}],"quickstart":{"code":"import { NetsuiteApiClient } from 'netsuite-api-client';\n\nasync function runNetsuiteOperations() {\n  const client = new NetsuiteApiClient({\n    consumer_key: process.env.NETSUITE_CONSUMER_KEY ?? '',\n    consumer_secret_key: process.env.NETSUITE_CONSUMER_SECRET_KEY ?? '',\n    token: process.env.NETSUITE_TOKEN ?? '',\n    token_secret: process.env.NETSUITE_TOKEN_SECRET ?? '',\n    realm: process.env.NETSUITE_REALM ?? '',\n    base_url: process.env.NETSUITE_BASE_URL ?? ''\n  });\n\n  try {\n    // Perform a GET request to fetch customer records\n    const response = await client.request({\n      path: 'record/v1/customer/',\n      method: 'GET'\n    });\n    console.log('Customer data:', response.data.links);\n\n    // Perform a SuiteQL query\n    const transactions = await client.query(\"select id from transaction where rownum <= 5\");\n    console.log('Transactions:', transactions);\n\n  } catch (err) {\n    console.error('Netsuite API Error:', err.message);\n  }\n}\n\nrunNetsuiteOperations();","lang":"typescript","description":"Instantiates the NetSuite API client using token-based authentication and performs a basic GET request for customer data, followed by a SuiteQL query."},"warnings":[{"fix":"Refactor `require()` statements to `import` statements. Ensure your `package.json` contains `\"type\": \"module\"` or use `.mjs` file extensions for ESM files.","message":"The package transitioned to ESM-only starting from version 1.0.0. Existing projects using CommonJS `require()` syntax will break and require migration to ESM `import` statements.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Update your code to access `response.data` instead of `response` directly when handling results from `client.request()` calls.","message":"In v1.0.0, the `result()` method (internally used by `request()`) changed its return structure. The parsed JSON data is now encapsulated within a `data` property of the response object, where previously it might have been directly returned.","severity":"breaking","affected_versions":"=1.0.0"},{"fix":"Access NetSuite specific error details via `err.message` directly. Avoid deeply inspecting properties like `err.response.body` which may contain the less-parsed `got` error.","message":"Starting with v0.1.4, error messages from NetSuite are directly surfaced in the `Error` object's `message` property. This simplifies error handling by removing the need to parse the underlying `got` `HttpError` object for NetSuite-specific details.","severity":"gotcha","affected_versions":">=0.1.4"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Verify the field names in your SuiteQL query against NetSuite's schema and ensure the integration role has appropriate permissions. Use `client.request({ path: \"record/v1/metadata-catalog/\" })` to inspect available resources and fields.","cause":"Attempting to query a non-existent, misspelled, or inaccessible field in a SuiteQL query.","error":"Invalid search query. Detailed unprocessed description follows. Search error occurred: Unknown identifier 'not_existing_field'."},{"fix":"Ensure your project is configured for ESM by setting `\"type\": \"module\"` in your `package.json` file. Change `const NetsuiteApiClient = require('netsuite-api-client');` to `import { NetsuiteApiClient } from 'netsuite-api-client';`.","cause":"This error typically occurs when attempting to import an ESM-only package using CommonJS `require()` syntax in a Node.js environment not configured for ESM.","error":"TypeError: NetsuiteApiClient is not a constructor"}],"ecosystem":"npm"}