You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is required by oci-typescript-sdk/lib/common/lib/auth/url-based-x509-certificate-supplier.ts
/** * Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved. * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. */import{parsePrivateKey,parseCertificate,Certificate,PrivateKey}from"sshpk";import{FetchHttpClient}from"../http";importX509CertificateSupplierfrom"./models/X509-certificate-supplier";importCertificateAndPrivateKeyPairfrom"./certificate-and-privatekey-pair";importRefreshablefrom"./models/refreshable";import{getStringFromResponseBody}from"../helper";importCircuitBreakerfrom"../circuit-breaker";importfetch,{Response}from"node-fetch";
The text was updated successfully, but these errors were encountered:
The root cause is that node-fetch is used at runtime, but it is only declared as a devDependency. This causes a failure in environments where a different version of node-fetch (e.g. v3+) is already installed at the project root.
In my case:
I’m working with JavaScript (not TypeScript),
My project uses "type": "module" in package.json,
This setup causes oci-common to break at runtime with a classic ERR_REQUIRE_ESM error, due to how require("node-fetch") behaves when v3 (ESM-only) is resolved from the parent project.
PR #314 seems to have captured this earlier, but appears to have stalled due to PR/process bottlenecks.
As a temporary workaround, I’m using this postinstall script in my package.json:
"postinstall": "if [ -d node_modules/oci-common ]; then cd node_modules/oci-common && npm i node-fetch@2.6.5; fi"
This locally installs node-fetch@2 under oci-common, making it resolvable by the legacy require() call.
Would really appreciate it if this could be patched upstream — either by moving node-fetch to regular dependencies, or adopting a dynamic import pattern that is compatible with ESM setups.
We encountered this issue on our side:
This is required by oci-typescript-sdk/lib/common/lib/auth/url-based-x509-certificate-supplier.ts
The text was updated successfully, but these errors were encountered: