Skip to content

Commit 5b0435f

Browse files
authored
fixed bugs
1 parent 8e3b1b1 commit 5b0435f

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ process.on('unhandledRejection', (reason, promise) => {
6565
process.exit(1);
6666
});
6767

68-
main();
68+
main();

src/openApiClient/index.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,13 @@ class OpenApiClient {
3939
accessKeySecret: config?.ALIBABA_CLOUD_ACCESS_KEY_SECRET,
4040
});
4141
} else {
42-
43-
const credentialsURI = process.env.ALIBABA_CLOUD_CREDENTIALS_URI;
44-
4542
// 参考 https://help.aliyun.com/zh/sdk/developer-reference/v2-manage-node-js-access-credentials
46-
if (credentialsURI) {
47-
// 方式一 使用 url 获取凭证
48-
const credentialClient = new Credential.default({
49-
type: 'credentials_uri',
50-
credentialsURI,
51-
} as any);
52-
apiConfig = new OpenApi.Config();
53-
// 使用Credentials配置凭证。
54-
apiConfig.credential = credentialClient;
55-
} else {
56-
// 方式二 使用默认凭证初始化Credentials Client
57-
const credentialClient = new Credential.default();
58-
apiConfig = new OpenApi.Config();
59-
// 使用Credentials配置凭证。
60-
apiConfig.credential = credentialClient;
61-
}
6243

44+
// 使用默认凭证初始化Credentials Client,
45+
const credentialClient = new Credential.default();
46+
apiConfig = new OpenApi.Config();
47+
// 使用Credentials配置凭证。@alicloud/credentials 2.4.2 已支持 credentialsURI
48+
apiConfig.credential = credentialClient;
6349
}
6450

6551
// Endpoint 请参考 https://api.aliyun.com/product/dataworks-public https://api.aliyun.com/product/CloudAPI

0 commit comments

Comments
 (0)