-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-sdk-v3-upgrade - bff #6
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
"test:int:ci": "eval \"$(assume-role) npm run test:int\"", | ||
"test:sls": "sls package --verbose -r us-west-2 -s np", | ||
"test:sls:ci": "eval \"$(assume-role) npm run test:sls\"", | ||
"start": "sls offline --port 3001 --apiKey test-int-api-key-123456 -r us-west-2 -s np", | ||
"start": "sls offline --httpPort 3001 --lambdaPort 3002 -r us-west-2 -s np", | ||
"dp:np:w": "sls deploy --verbose -r us-west-2 -s np --force", | ||
"dp:np:e": "sls deploy --verbose -r us-east-1 -s np --force", | ||
"dp:prd:w": "sls deploy --verbose -r us-west-2 -s prd --force", | ||
|
@@ -27,14 +27,16 @@ | |
"command": "nyc mocha --recursive \"./test/unit/**/*.test.js\"", | ||
"env": { | ||
"NODE_ENV": "test", | ||
"AES": "false", | ||
"AWS_REGION": "us-west-2", | ||
"KMS_REGIONS": "us-east-1,us-west-2" | ||
} | ||
}, | ||
"test:int": { | ||
"command": "npm start -- --exec \"mocha --timeout 20000 --require @babel/register --recursive ./test/helper.js \"./test/int/**/*.test.js\"\"", | ||
"command": "start-test --expect 404 http://localhost:3002 'mocha --timeout 20000 --require @babel/register --recursive ./test/helper.js \"./test/int/**/*.test.js\"'", | ||
"env": { | ||
"NODE_ENV": "test", | ||
"AES": "false", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. turn AES off in the serverless-offline http and lambda processes |
||
"AWS_REGION": "us-west-2", | ||
"KMS_REGIONS": "us-east-1,us-west-2", | ||
"DEBUG": "tbd*" | ||
|
@@ -50,54 +52,66 @@ | |
} | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.17.10", | ||
"@babel/core": "^7.17.10", | ||
"@babel/eslint-parser": "^7.17.0", | ||
"@babel/plugin-transform-runtime": "^7.17.10", | ||
"@babel/preset-env": "^7.17.7", | ||
"@babel/register": "^7.17.7", | ||
"@aws-sdk/client-dynamodb": "^3.450.0", | ||
"@aws-sdk/client-eventbridge": "^3.450.0", | ||
"@aws-sdk/client-kms": "^3.450.0", | ||
"@aws-sdk/client-lambda": "^3.450.0", | ||
"@aws-sdk/client-s3": "^3.450.0", | ||
"@aws-sdk/client-secrets-manager": "^3.450.0", | ||
"@aws-sdk/client-sns": "^3.450.0", | ||
"@aws-sdk/client-sqs": "^3.450.0", | ||
"@aws-sdk/lib-dynamodb": "^3.450.0", | ||
"@aws-sdk/s3-request-presigner": "^3.450.0", | ||
"@aws-sdk/util-dynamodb": "^3.450.0", | ||
"@babel/cli": "^7.23.0", | ||
"@babel/core": "^7.23.0", | ||
"@babel/eslint-parser": "^7.23.3", | ||
"@babel/plugin-transform-runtime": "^7.23.3", | ||
"@babel/preset-env": "^7.23.3", | ||
"@babel/register": "^7.23.3", | ||
"aws-assume-role-cicd": "^1.0.4", | ||
"aws-sdk": "^2.1133.0", | ||
jgilbert01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"aws-sdk-mock": "^5.7.0", | ||
"babel-loader": "^8.2.5", | ||
"aws-sdk-client-mock": "^3.0.0", | ||
"babel-loader": "^9.1.3", | ||
"babel-plugin-istanbul": "^6.1.1", | ||
"baton-vcr-replay-for-aws-sdk": "^1.0.1", | ||
"baton-vcr-serverless-plugin": "^1.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these no longer work with the newer versions of serverless-offline
jgilbert01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"better-npm-run": "^0.1.1", | ||
"chai": "^4.3.6", | ||
"eslint": "^8.15.0", | ||
"eslint": "^8.53.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-formatter-pretty": "^4.1.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"husky": "^8.0.1", | ||
"lint-staged": "^12.4.1", | ||
"lint-staged": "^15.1.0", | ||
"mocha": "^10.0.0", | ||
"nock": "^13.2.4", | ||
"nyc": "^15.1.0", | ||
"serverless": "^3.0.0", | ||
"serverless": "^3.36.0", | ||
jgilbert01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"serverless-aws-describe-plugin": "^1.0.0", | ||
"serverless-kinesis-esm-plugin": "^1.0.1", | ||
"serverless-offline": "^5.0.0", | ||
"serverless-offline": "^13.3.3", | ||
"serverless-webpack": "^5.7.1", | ||
"sinon": "^14.0.0", | ||
"sinon-chai": "^3.5.0", | ||
"start-server-and-test": "^2.0.3", | ||
"supertest": "^6.2.3", | ||
"webpack": "^4.46.0", | ||
"webpack-node-externals": "^2.5.2" | ||
"webpack": "^5.89.0", | ||
"webpack-node-externals": "^3.0.0" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.17.9", | ||
"aws-kms-ee": "^0.14.0", | ||
"aws-lambda-stream": "^0.49.0", | ||
"@babel/runtime": "^7.23.2", | ||
"@smithy/node-http-handler": "^2.1.9", | ||
"@smithy/util-retry": "^2.1.1", | ||
"@smithy/util-stream": "^2.1.1", | ||
"aws-kms-ee": "^1.0.0", | ||
"aws-lambda-stream": "^1.0.0", | ||
"bluebird": "^3.7.2", | ||
"debug": "^4.1.0", | ||
"debug": "^4.3.4", | ||
"highland": "^2.13.5", | ||
"isomorphic-fetch": "^3.0.0", | ||
"lambda-api": "^0.11.2", | ||
"lodash": "^4.17.21", | ||
"memory-cache": "^0.2.0", | ||
"moment": "^2.29.4", | ||
"node-fetch": "^2.6.1", | ||
"uuid": "^3.3.3" | ||
"uuid": "^9.0.1" | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should update this to not import from root index file. Since this test is still importing from the root index file, you'll have to add all the other aws-sdk dependencies like cloudwatch, etc. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ export class Handler { | |
this.options = options; | ||
} | ||
|
||
handle(event, includeErrors = true) { | ||
handle(event, includeErrors = !process.env.IS_OFFLINE) { | ||
return initialize(PIPELINES, this.options) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. automatically turn off fault handling for integration tests |
||
.assemble( | ||
fromSqsEvent(event) | ||
|
@@ -42,13 +42,13 @@ export class Handler { | |
} | ||
} | ||
|
||
export const handle = async (event, context, int = {}) => { | ||
export const handle = async (event, context) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this argument can no longer be passed by the int tests |
||
debug('event: %j', event); | ||
debug('context: %j', context); | ||
|
||
// const options = await getSecrets(OPTIONS); | ||
|
||
return new Handler({ ...OPTIONS, ...int }) | ||
return new Handler(OPTIONS) | ||
.handle(event) | ||
.through(toPromise); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,14 @@ import 'mocha'; | |
import { expect } from 'chai'; | ||
|
||
import { toKinesisRecords, toSqsEventRecords } from 'aws-lambda-stream'; | ||
import lambdaTest from 'aws-lambda-stream/utils/lambda-test'; | ||
|
||
import { handle } from '../../../src/listener'; | ||
const invoke = lambdaTest({ functionName: `${process.env.npm_package_name}-dev-listener` }); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
describe('listener/index.js', () => { | ||
before(() => { | ||
require('baton-vcr-replay-for-aws-sdk'); // eslint-disable-line global-require | ||
}); | ||
|
||
it('should test listener integration', async () => { | ||
const res = await handle(EVENT, {}, { AES: false }); | ||
expect(res).to.equal('Success'); | ||
const res = await invoke(EVENT); | ||
expect(res.Payload).toEqual('Success'); | ||
}); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
// eslint-disable-next-line no-unused-vars | ||
import * as sinon from 'sinon'; | ||
import * as utils from '../../src/utils'; | ||
import Replay from 'replay'; | ||
jgilbert01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// ========================== | ||
// Mock dates, uuids, etc | ||
// ========================== | ||
sinon.stub(utils, 'now').returns(1653877763001); // TODO update when re-recording | ||
|
||
// ========================== | ||
// VCR - https://github.com/assaf/node-replay | ||
// ========================== | ||
Replay.mode = process.env.REPLAY; | ||
console.log(`Replay mode = ${Replay.mode}`); | ||
|
||
// typical headers | ||
Replay.headers = [/^x-amz-target/].concat(Replay.headers.filter((header) => !header.test('authorization') && !header.test('x-'))); | ||
|
||
// monkey patch replay to avoid immediate max retries and ultimately timeout | ||
const rproxy = require('replay/lib/proxy'); | ||
rproxy.prototype.setTimeout = () => { }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serverless-offline no longer supports the --exec arg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.