Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions lib/plugins/aws/custom-resources/resources/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,18 @@ function getEnvironment(context) {
}

function handlerWrapper(handler, PhysicalResourceId) {
return async (event, context, callback) => {
return async (event, context) => {
// extend the `event` object to include the PhysicalResourceId
event = Object.assign({}, event, { PhysicalResourceId });
return Promise.resolve(handler(event, context, callback))
.then(
(result) => response(event, context, 'SUCCESS', result),
(error) => response(event, context, 'FAILED', {}, error)
)
.then((result) => callback(null, result), callback);

try {
const result = await handler(event, context);
await response(event, context, 'SUCCESS', result);
return result;
} catch (error) {
await response(event, context, 'FAILED', {}, error);
throw error;
}
};
}

Expand Down