Registry / devops / oci-core

oci-core

JSON →
library2.132.0jsnpmunverified

Oracle Cloud Infrastructure Core Service client for Node.js, part of the official OCI TypeScript/JavaScript SDK (v2.132.0). Enables management of compute, networking, storage, and other core resources via the OCI API. Integrates with OCI identity/access management, signing, and configuration. Regularly updated alongside the OCI platform. Alternative to raw HTTP calls; provides typed interfaces, promise-based requests, and automatic retry handling. Supports both ESM and CJS via commonjs-compatible build.

npm install oci-core
INSTALL
IMPORT
SIG · OCI-CORE
O
oci-core
devopsjavascriptv2.132.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CoreClient
import { CoreClient } from 'oci-core';
const CoreClient = require('oci-core').CoreClient;
SDK ships TypeScript types; ESM imports are preferred but CJS require is also supported using destructuring.
models
import * as models from 'oci-core/lib/models';
const models = require('oci-core').models;
Models are exported from 'oci-core/lib/models'. Alternatively, import individual model classes: import { Instance } from 'oci-core/lib/models';
CreateVcnRequest
import { CreateVcnRequest } from 'oci-core/lib/requests';
const CreateVcnRequest = require('oci-core').requests.CreateVcnRequest;
Request types are available under 'oci-core/lib/requests' for typed request objects.

Creates a CoreClient using OCI config file auth, then lists compute instances in a compartment.

import { CoreClient } from 'oci-core'; import common = require('oci-common'); const provider = new common.ConfigFileAuthenticationDetailsProvider(); const client = new CoreClient({ authenticationDetailsProvider: provider }); async function listInstances() { const compartmentId = process.env.COMPARTMENT_ID || ''; const response = await client.listInstances({ compartmentId: compartmentId }); console.log(response.items); } listInstances();
Debug
Known issues
gotchaAll client methods return a Promise; must await or use .then().
fix
Use async/await or .then() on all API calls.
affects: *
gotchaRegion must be set either in config, or via environment variable OCI_REGION, or passed in constructor options.
fix
Ensure the config file or environment has the region set correctly.
affects: *
gotchaPagination: list operations return a response with items and opc-next-page header; you must manually loop to get all results.
fix
Use a loop reading the opc-next-page header until it is undefined.
affects: *
breakingOCI SDK v2 major redesign: removed bundling of all services in one package; each service is separate.
fix
Install oci-core separately instead of depending on monolithic oci-sdk package.
affects: >=2.0.0
Errors
Common errors & fixes
Error: getaddrinfo ENOTFOUND iaas.us-phoenix-1.oraclecloud.com
Region not set correctly or wrong endpoint.
fix
Check OCI_REGION env variable or config file region. Also verify network connectivity to OCI endpoints.
TypeError: Cannot read properties of undefined (reading 'authenticationDetailsProvider')
Missing or misconfigured authentication provider (e.g., config file not found).
fix
Ensure ~/.oci/config exists and has correct permissions. Use common.ConfigFileAuthenticationDetailsProvider() with correct path.
Upgrade
Version history
2.132.0latest on npm
Audit
Dependencies
oci-commonrequiredCore SDK includes common utilities, auth, and request signing from oci-common.
Agent activity
8 hits · last 30 days
node
8
Resources
oci-core — npm install oci-core · libregistry