Skip to content

Commit 5d98703

Browse files
committed
fix: run functions locally using serverless invoke local and without having to pass context
1 parent 598b977 commit 5d98703

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Service/Logger.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default class LoggerService extends DependencyAwareClass {
5050
const container = this.getContainer();
5151
const event = container.getEvent();
5252
const context = container.getContext();
53-
const isOffline = context.invokedFunctionArn.indexOf('offline') !== -1;
53+
const isOffline = !Object.prototype.hasOwnProperty.call(context, 'invokedFunctionArn') || context.invokedFunctionArn.indexOf('offline') !== -1;
5454

5555
// Set raven client context
5656
if (ravenIsAvailable && isOffline === false) {

src/Service/SQS.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default class SQSService extends DependencyAwareClass {
3333
super(di);
3434
const context = this.getContainer().getContext();
3535
const queues = this.getContainer().getConfiguration('QUEUES');
36-
const isOffline = context.invokedFunctionArn.indexOf('offline') !== -1;
36+
const isOffline = !Object.prototype.hasOwnProperty.call(context, 'invokedFunctionArn') || context.invokedFunctionArn.indexOf('offline') !== -1;
3737

3838
this.queues = {};
3939

0 commit comments

Comments
 (0)