oracle / oci-typescript-sdk

Oracle Cloud Infrastructure SDK for TypeScript and JavaScript
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/typescriptsdk.htm
Other
71 stars 51 forks source link

Alloy config file not found at [object Object], enabling all OCI services as default. #243

Closed sunao417t33 closed 9 months ago

sunao417t33 commented 10 months ago

Thank you for developing the OCI SDK! My app, which uses the oci-typescript-sdk, is currently displaying the following message:

"Alloy config file not found at [object Object], enabling all OCI services as default."

This message is generated from the alloyConfiguration.ts file added in version 2.73.1, and it appears to be triggered by the absence of the alloy-config.json file. I think this message should not be shown to users who do not use OCI Alloy.

I would prefer that AlloyConfiguration.alloyConfiguration() is executed only if isAlloyRegion is true.

oci-typescript-sdk/lib/common/lib/region.ts:


private constructor(regionId: string, realm: Realm, regionCode?: string, isAlloyRegion: boolean = false) {
    this._realm = realm;
    this._regionId = regionId;
    if (regionCode) this._regionCode = regionCode;
    AlloyConfiguration.alloyConfiguration();
    if (isAlloyRegion) {
        Region.ALLOY_REGIONS.set(regionId, this);
    } else {
        Region.KNOWN_REGIONS.set(regionId, this);
    }
}

Is this the intended behavior?

jyotisaini commented 10 months ago

Thanks for reporting this @sunao417t33 . No this is not the intended behaviour. Can you let us know what is the log.level you are using in your app?

sunao417t33 commented 10 months ago

@jyotisaini Thank you for your response. I haven't configured a specific logging level in my app; I simply let it run in Node.js. I apologize if I misunderstood your question.

My app is a command-line tool that I created by extending the original oci-typescript-sdk/examples/typescript/audit.ts. Consequently, I can reproduce this issue using the following commands:

$ mkdir test && cd test
$ npm install typescript@4.1.3
$ npm install oci-sdk
$ cp ../oci-typescript-sdk-master/examples/typescript/audit.ts .
$ node_modules/typescript/bin/tsc audit.ts
$ node audit.js
Alloy config file not found at [object Object], enabling all OCI services as default
Alloy config file not found at [object Object], enabling all OCI services as default
Alloy config file not found at [object Object], enabling all OCI services as default
Alloy config file not found at [object Object], enabling all OCI services as default

If it appears that I am using the above SDK incorrectly, I'd appreciate knowing!

zotijs commented 10 months ago

+1

Downgrading to 2.71.0 worked for me.

alexchristopoulos commented 10 months ago

+1

jyotisaini commented 9 months ago

Thanks @sunao417t33 . Our team is working on a fix to remove these messages and executed only when isAlloyRegion is True

petr-synek commented 9 months ago

This would not be an issue if you fix #128 . Here again you use console.log() to output debugging information, which is totally unacceptable for a library.

JoshuaWR commented 9 months ago

Hi @sunao417t33, this issue should be resolved with changes made in the newest release of the SDK, v2.76.0. Could you try upgrading to this version?

sunao417t33 commented 9 months ago

Thanks @JoshuaWR. I upgraded to 2.76.0 and it works! Please close.