File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change
1
+ import * as path from 'path' ;
2
+ import * as fs from 'fs' ;
1
3
import * as process from 'process' ;
2
- // We need to set this early because of https://github.com/aws/aws-sdk-js/pull/1391
3
- process . env . AWS_SDK_LOAD_CONFIG = '1' ;
4
+
5
+ const awsUserDir = process . env . HOME ? path . join ( process . env . HOME as string , '.aws' ) : null ;
6
+ if ( awsUserDir && fs . existsSync ( awsUserDir ) ) {
7
+ // We need to set this early because of https://github.com/aws/aws-sdk-js/pull/1391
8
+ // We also set this env-var in the main cli entry-point
9
+ process . env . AWS_SDK_LOAD_CONFIG = '1' ; // see https://github.com/aws/aws-sdk-js/pull/1391
10
+ // Note:
11
+ // if this is set and ~/.aws doesn't exist we run into issue #17 as soon as the sdk is loaded:
12
+ // Error: ENOENT: no such file or directory, open '.../.aws/credentials
13
+ }
14
+
4
15
// Use bluebird promises globally. We need to load this prior to 'aws-sdk'
5
16
import * as bluebird from 'bluebird' ;
6
17
global . Promise = bluebird ;
Original file line number Diff line number Diff line change 1
1
import * as process from 'process' ;
2
- process . env . AWS_SDK_LOAD_CONFIG = '1' ; // see https://github.com/aws/aws-sdk-js/pull/1391
3
- // We also set this env-var in the main cli entry-point
4
2
5
3
import * as fs from 'fs' ;
6
4
import * as path from 'path' ;
5
+
6
+ const awsUserDir = process . env . HOME ? path . join ( process . env . HOME as string , '.aws' ) : null ;
7
+ if ( awsUserDir && fs . existsSync ( awsUserDir ) ) {
8
+ // We also set this env-var in the main cli entry-point
9
+ process . env . AWS_SDK_LOAD_CONFIG = '1' ; // see https://github.com/aws/aws-sdk-js/pull/1391
10
+ // Note:
11
+ // if this is set and ~/.aws doesn't exist we run into issue #17 as soon as the sdk is loaded:
12
+ // Error: ENOENT: no such file or directory, open '.../.aws/credentials
13
+ }
14
+
15
+ import * as _ from 'lodash' ;
7
16
import * as aws from 'aws-sdk' ;
8
17
9
18
import { logger } from './logger' ;
You can’t perform that action at this time.
0 commit comments