Skip to content

Commit 8f1ccb5

Browse files
authored
Debug build (#44)
Tracking down #43 Bumping node runtime to latest Added suffix to template
1 parent d2fe4e2 commit 8f1ccb5

File tree

9 files changed

+23
-8
lines changed

9 files changed

+23
-8
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
- run:
1010
name: update-npm
1111
command: 'sudo npm install -g npm@latest'
12-
- restore_cache:
13-
key: dependency-cache-{{ checksum "package.json" }}
12+
# - restore_cache:
13+
# key: dependency-cache-{{ checksum "package.json" }}
1414
- run:
1515
name: install-npm-wee
1616
command: npm install
@@ -39,8 +39,8 @@ jobs:
3939
- run:
4040
name: update-npm
4141
command: 'sudo npm install -g npm@latest'
42-
- restore_cache:
43-
key: dependency-cache-{{ checksum "package.json" }}
42+
# - restore_cache:
43+
# key: dependency-cache-{{ checksum "package.json" }}
4444
- run:
4545
name: install-npm-wee
4646
command: npm install

lib/ag-handler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const pkg = require('../package.json');
1111
*/
1212
exports.handler = async (event, context, callback) => {
1313
console.log(`handling callback event using ${pkg.name}/v${pkg.version}`);
14+
console.log(`environment:${JSON.stringify(process.env)}`);
1415

1516
try {
1617
assert.ok(event.body !== undefined, "event had no body");

lib/s3-handler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ exports.handler = async (event, context, callback) => {
1717

1818
try {
1919
console.log(`handling s3 event using ${pkg.name}/v${pkg.version}`);
20+
console.log(`environment:${JSON.stringify(process.env)}`);
2021

2122
// pre-flight checks:
2223
assert.ok(CONFIG.CALLBACK_URL !== null, "api callback url cannot be null");

template.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Parameters:
1212
scaniiApiSecret:
1313
Description: Your scanii.com API secret
1414
Type: String
15+
envSuffix:
16+
Description: The environment name (a suffix really) to be appended to your lambda functions
17+
Type: String
18+
Default: prod
1519
actionTagObject:
1620
Description: Should custom tags be added to S3 objects after processing?
1721
Type: String
@@ -33,9 +37,9 @@ Resources:
3337
DependsOn: ScaniiCallbackFn
3438
Properties:
3539
CodeUri: .
36-
FunctionName: uvasoftware-scanii-lambda-submit
40+
FunctionName: !Sub "uvasoftware-scanii-lambda-submit-${envSuffix}"
3741
Handler: lib/s3-handler.handler
38-
Runtime: nodejs10.x
42+
Runtime: nodejs12.x
3943
MemorySize: 256
4044
Timeout: 60
4145
Description: Submits objects to be analyzed by scanii.com
@@ -56,9 +60,9 @@ Resources:
5660
Type: AWS::Serverless::Function
5761
Properties:
5862
CodeUri: .
59-
FunctionName: uvasoftware-scanii-lambda-callback
63+
FunctionName: !Sub "uvasoftware-scanii-lambda-callback-${envSuffix}"
6064
Handler: lib/ag-handler.handler
61-
Runtime: nodejs10.x
65+
Runtime: nodejs12.x
6266
MemorySize: 256
6367
Timeout: 60
6468
Description: Handles scanii.com's result callbacks

tests/actions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const assert = require('assert');
22
const it = require("mocha/lib/mocha.js").it;
33
const describe = require("mocha/lib/mocha.js").describe;
4+
const beforeEach = require("mocha/lib/mocha.js").beforeEach;
5+
const afterEach = require("mocha/lib/mocha.js").afterEach;
46
const actions = require('../lib/actions');
57
const AWS = require('aws-sdk-mock');
68

tests/ag-handler.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const handler = require('../lib/ag-handler.js').handler;
22
const assert = require('assert');
33
const it = require("mocha/lib/mocha.js").it;
44
const describe = require("mocha/lib/mocha.js").describe;
5+
const beforeEach = require("mocha/lib/mocha.js").beforeEach;
6+
const afterEach = require("mocha/lib/mocha.js").afterEach;
57
const utils = require('../lib/utils.js');
68
const CONFIG = require('../lib/config').CONFIG;
79
const AWS = require('aws-sdk-mock');

tests/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const assert = require('assert');
22
const it = require("mocha/lib/mocha.js").it;
33
const describe = require("mocha/lib/mocha.js").describe;
4+
const beforeEach = require("mocha/lib/mocha.js").beforeEach;
5+
const afterEach = require("mocha/lib/mocha.js").afterEach;
46
const CONFIG = require('../lib/config').CONFIG;
57
const actions = require('../lib/actions');
68
const AWS = require('aws-sdk-mock');

tests/s3-handler.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const handler = require('../lib/s3-handler').handler;
22
const assert = require('assert');
33
const it = require("mocha/lib/mocha.js").it;
44
const describe = require("mocha/lib/mocha.js").describe;
5+
const beforeEach = require("mocha/lib/mocha.js").beforeEach;
6+
const afterEach = require("mocha/lib/mocha.js").afterEach;
57
const AWS = require('aws-sdk');
68
const nock = require('nock');
79
const CONFIG = require('../lib/config').CONFIG;

tests/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const assert = require('assert');
22
const it = require("mocha/lib/mocha.js").it;
33
const describe = require("mocha/lib/mocha.js").describe;
4+
const beforeEach = require("mocha/lib/mocha.js").beforeEach;
45
const utils = require('../lib/utils');
56

67
describe('Util tests', () => {

0 commit comments

Comments
 (0)