-
Notifications
You must be signed in to change notification settings - Fork 29
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
Handle network errors in Lambda client #100
Conversation
…reated as AWS errors
Hi @ziltodian 👋🏻 Thanks a lot for your contribution 🙇🏻 We looked thoroughly into your use-case and PR with @codebien and reached the conclusion we'd like to pursue going in this direction indeed. However, we'd like to go even step further, and would like to propose more changes to your PR if you have the capacity to contribute further to it. At the moment, the Dedicated network error typesAs you might have found in the k6 documentation, the error_code that k6 returns offers some level of granularity and context as to what happened. The error codes described in the doc fall essentially into X categories:
As a result, we'd like to define Custom lambda error typesBut what should we do with the standard HTTP error status codes, then? We suggest creating dedicated Next stepsWe believe this would be the right design moving forward, not only for the lambda client, but for the whole library. In this PR our expectation is that we would modify only the lambda client (and maybe the Is this something you'd have the capacity to work on? We wouldn't be able to merge the PR in its current state, but if you don't have the capacity to work on the proposed changes, let us know, and we'll try to contribute some of the changes we had in mind ourselves. Let us know 🙇🏻 |
# Conflicts: # dist/aws.js # dist/aws.js.map # dist/event-bridge.js # dist/event-bridge.js.map # dist/index.js # dist/index.js.map # dist/kinesis.js # dist/kinesis.js.map # dist/kms.js # dist/kms.js.map # dist/lambda.js # dist/lambda.js.map # dist/s3.js # dist/s3.js.map # dist/secrets-manager.js # dist/secrets-manager.js.map # dist/signature.js # dist/signature.js.map # dist/sqs.js # dist/sqs.js.map # dist/ssm.js # dist/ssm.js.map
Quick heads-up that we have startd preparing a branch introducing the base error types I mentioned earlier, and will open a PR soon-ish. |
Hi @ziltodian 👋🏻 Thanks a lot, again, for your contribution 🙇🏻 We have shipped custom error types that match the k6 error codes as described above. Whenever performing lambda operations, you should be able to I invite you to check error.ts and its definitions to get a feeling for the new error kinds, and also notice AWSClient now have a base I will close this PR, but feel free to open an issue if you have further questions or needs 🙇🏻 |
The Lambda client treats all errors (apart from Lambda function errors) as AWS errors. This small change checks the
response.error_code
to see if the error is an HTTP error or some other kind of network error (https://k6.io/docs/javascript-api/error-codes/). It also exports bothAWSError
andNetworkError
. Our use case for this is that sometimes we encounter network errors where the Lambda invocation request never makes it to AWS. We need to identify when this occurs so we can exclude these failures from our test results. Currently we check if the error.name is "AWSError" and error.code is empty string. We'd like to be able to check for an instance ofNetworkError
instead.