The official Oracle Cloud Infrastructure SDK module for the ONS (Oracle Notification Service) in Node.js. Version 2.132.0 is the latest stable release, part of the oci-typescript-sdk monorepo. This package provides programmatic access to ONS topics and subscriptions. It is maintained by Oracle and follows the monthly SDK release cadence. Key differentiators: first-class TypeScript support, use with OCI authentication providers (config file, instance principals, resource principals), and support for both ESM and CommonJS. It requires the oci-common package for authentication and configuration.
npm install oci-onsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize ONS client with config file auth and list topics in a compartment.
Use import syntax or ensure CJS interop. If using require(), use: const { OnsClient } = require('oci-ons').default; or use dynamic import().Upgrade to version 2.x: npm install oci-ons@latest
Always pass a valid authentication provider from oci-common, e.g., ConfigFileAuthenticationDetailsProvider or InstancePrincipalsAuthenticationDetailsProvider.
Ensure the user or instance has proper IAM policies for ons topic and subscription management.
Always handle promises with async/await or .catch().
Use named import: import { OnsClient } from 'oci-ons'; and instantiate with 'new'.Ensure your OCI config file (~/.oci/config) contains a region entry, or set the OCI_REGION environment variable.
npm install oci-common
Create the OCI config file at ~/.oci/config or use a different authentication provider (e.g., InstancePrincipalsAuthenticationDetailsProvider).