lambda-serverless-api
Advanced tools
Comparing version 1.12.5 to 1.12.6
@@ -31,6 +31,5 @@ const xor = require('lodash.xor'); | ||
const generateResponse = (err, resp, callback, rb) => { | ||
const generateResponse = (err, resp, rb) => { | ||
if (err instanceof response.ApiErrorClass) { | ||
return rb.warning(err).then(callback(null, { | ||
return rb.warning(err).then(() => ({ | ||
statusCode: err.statusCode, | ||
@@ -45,9 +44,9 @@ body: JSON.stringify({ | ||
if (resp instanceof response.ApiResponseClass) { | ||
return callback(null, { | ||
return { | ||
statusCode: resp.statusCode, | ||
body: resp.payload, | ||
headers: resp.headers | ||
}); | ||
}; | ||
} | ||
return callback(err); | ||
throw err; | ||
}; | ||
@@ -69,3 +68,3 @@ | ||
return rollbar | ||
.wrap((event, context, callback, rb) => limiter | ||
.wrap((event, context, rb) => limiter | ||
.check(limit, get(event, 'requestContext.identity.sourceIp')) | ||
@@ -76,5 +75,5 @@ .catch(() => { | ||
.then(() => parse(request, params, event)) | ||
.then(paramsOut => handler(paramsOut, context, callback, rb)) | ||
.then(payload => generateResponse(null, payload, callback, rb)) | ||
.catch(err => generateResponse(err, null, callback, rb))); | ||
.then(paramsOut => handler(paramsOut, context, rb)) | ||
.then(payload => generateResponse(null, payload, rb)) | ||
.catch(err => generateResponse(err, null, rb))); | ||
}; | ||
@@ -81,0 +80,0 @@ |
@@ -24,3 +24,3 @@ { | ||
}, | ||
"version": "1.12.5", | ||
"version": "1.12.6", | ||
"scripts": { | ||
@@ -54,3 +54,3 @@ "test": "node gardener && nyc mocha --recursive", | ||
"lambda-rate-limiter": "2.4.3", | ||
"lambda-rollbar": "1.8.2", | ||
"lambda-rollbar": "1.9.1", | ||
"lodash.defaultsdeep": "4.6.0", | ||
@@ -57,0 +57,0 @@ "lodash.get": "4.4.2", |
@@ -41,3 +41,3 @@ [![Build Status](https://img.shields.io/travis/simlu/lambda-serverless-api/master.svg)](https://travis-ci.org/simlu/lambda-serverless-api) | ||
api.Str("password", "json") | ||
], process.env.RATE_LIMIT_PER_IP, ([name, email, password], context, callback, rb) => { | ||
], process.env.RATE_LIMIT_PER_IP, ([name, email, password], context, rb) => { | ||
// handle registration logic here ... | ||
@@ -44,0 +44,0 @@ if (new Date().getHours() === 4) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17479
+ Addedlambda-rollbar@1.9.1(transitive)
- Removedlambda-rollbar@1.8.2(transitive)
Updatedlambda-rollbar@1.9.1