Skip to content

Commit d19c08b

Browse files
Fix expired security token issue (#30)
In order to have a more robust solution for the internal calls to AWS, the following has been improved: * Fix expired security token issue by always use fresh credentials provided by CloudFormation. We need to take into account the fact that lambda execution context are being reused, so ensure new values for credentials and settings are refreshed even when the `BaseResource` instance is the same from previous call. * Use queue to avoid throttling of AWS API calls (specially CloudWatch). * Optional use of worker threads for performance reasons.
1 parent 4594481 commit d19c08b

25 files changed

+2824
-1820
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ target/
66
node_modules/
77
coverage/
88
python/
9+
.eslintrc.js

.eslintrc.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
plugins: ['@typescript-eslint', 'prettier', 'import', 'prefer-arrow'],
77
parser: '@typescript-eslint/parser',
88
parserOptions: {
9-
ecmaVersion: '2017',
9+
ecmaVersion: 2017,
1010
sourceType: 'module',
1111
project: './tsconfig.eslint.json',
1212
},
@@ -21,21 +21,32 @@ module.exports = {
2121
},
2222
'import/resolver': {
2323
node: {},
24-
typescript: {
25-
directory: './tsconfig.eslint.json',
26-
},
24+
typescript: {},
2725
},
2826
},
2927
ignorePatterns: ['*.d.ts', '*.generated.ts'],
3028
rules: {
3129
// Require use of the `import { foo } from 'bar';` form instead of `import foo = require('bar');`
3230
'@typescript-eslint/no-require-imports': ['error'],
3331

34-
'@typescript-eslint/ban-ts-ignore': ['warn'],
32+
'@typescript-eslint/ban-ts-comment': ['warn'],
33+
'@typescript-eslint/ban-types': ['warn'],
3534
'@typescript-eslint/no-empty-function': ['warn'],
35+
'@typescript-eslint/no-explicit-any': ['warn'],
3636

3737
// Require all imported dependencies are actually declared in package.json
3838
'import/no-extraneous-dependencies': ['error'],
3939
'import/no-unresolved': ['error'],
4040
},
41+
overrides: [
42+
{
43+
files: ['*.js', '*.jsx'],
44+
rules: {
45+
'@typescript-eslint/explicit-function-return-type': 'off',
46+
'@typescript-eslint/no-unused-vars': 'off',
47+
'@typescript-eslint/no-var-requires': 'off',
48+
'@typescript-eslint/no-require-imports': 'off',
49+
},
50+
},
51+
],
4152
};

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
pip install --use-feature=2020-resolver .
3636
- uses: actions/setup-node@v1
3737
with:
38-
node-version: 12
38+
node-version: 14
3939
- name: Install Dependencies Node.js
4040
id: install_nodejs
4141
# Touch needed because of https://github.com/aws/aws-cli/issues/2639
@@ -66,9 +66,9 @@ jobs:
6666
RPDK_PATH=$PWD/$RPDK_PACKAGE
6767
DIR=$(mktemp -d)
6868
cd "$DIR"
69-
echo ::set-env name=PROJECT_DIR::$DIR
69+
echo "PROJECT_DIR=$DIR" >> $GITHUB_ENV
7070
ls -la
71-
printf "AWS::Foo::Bar\n1\nn" | cfn init -vv
71+
printf "n" | cfn init -vv -t AWS::Foo::Bar
7272
ls -la
7373
mkdir ./dist
7474
cp "$RPDK_PATH" ./dist

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ dmypy.json
128128
.vscode/
129129
*.tar.gz
130130
*.tgz
131+
src/workers/*.js
132+
src/workers/*.d.ts
133+
tests/**/*.js
134+
tests/**/*.d.ts
131135

132136
# We want to allow the tests/lib folder
133137
!tests/lib

jest.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ module.exports = {
33
testEnvironment: 'node',
44
globals: {
55
'ts-jest': {
6-
diagnostics: false, // Necessary to avoid typeschecking error in decorators
6+
ignoreCoverageForAllDecorators: true,
77
},
88
},
99
testRegex: '\\.test.ts$',
10+
testRunner: 'jest-circus/runner',
1011
coverageThreshold: {
1112
global: {
1213
branches: 70,
@@ -17,4 +18,8 @@ module.exports = {
1718
collectCoverage: true,
1819
coverageReporters: ['json', 'lcov', 'text'],
1920
coveragePathIgnorePatterns: ['/node_modules/', '/tests/data/'],
21+
testTimeout: 60000,
22+
moduleNameMapper: {
23+
'^~/(.*)$': '<rootDir>/src/$1',
24+
},
2025
};

0 commit comments

Comments
 (0)