Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

aws-sdk-v3-upgrade - bff #6

wants to merge 6 commits into from

Conversation

jgilbert01
Copy link
Owner

No description provided.

"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\"'",
Copy link
Owner Author

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

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the lambda endpoint of 3002 returns a 404 when start-test sends a ping request
  • since there is no ping function defined
  • but that is good enough to know that serverless-offline is up

"env": {
"NODE_ENV": "test",
"AES": "false",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turn AES off in the serverless-offline http and lambda processes

"babel-plugin-istanbul": "^6.1.1",
"baton-vcr-replay-for-aws-sdk": "^1.0.1",
"baton-vcr-serverless-plugin": "^1.0.0",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these no longer work with the newer versions of serverless-offline

@@ -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)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automatically turn off fault handling for integration tests

@@ -42,13 +42,13 @@ export class Handler {
}
}

export const handle = async (event, context, int = {}) => {
export const handle = async (event, context) => {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this argument can no longer be passed by the int tests


import { handle } from '../../../src/listener';
const invoke = lambdaTest({ functionName: `${process.env.npm_package_name}-dev-listener` });

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • this util works similar to supertest in the api gateway integration tests
  • it calls the serverless-offline lambda endpoint on 3002


// monkey patch replay to avoid immediate max retries and ultimately timeout
const rproxy = require('replay/lib/proxy');
rproxy.prototype.setTimeout = () => { };
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • serverless-offline now starts the api gateway and lambda endpoints in separate processes from the serverless framework
  • but the baton vcr plugin runs in the sls process
  • so we need to include Replay in the webpack bundle so that we initialize it in the right processes

Choose a reason for hiding this comment

The 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.

externals: [
nodeExternals()
],
plugins: includeMocks() ? [new EnvironmentPlugin({ REPLAY: process.env.REPLAY })] : undefined,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow developers to set the REPLAY env var from the cli when running/recording tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants