Skip to content

Commit 1836242

Browse files
author
Russell Pekala
committed
start non-SQS lambdas, default to localhost
1 parent 6a0e172 commit 1836242

File tree

1 file changed

+13
-4
lines changed
  • packages/serverless-offline-sqs/src

1 file changed

+13
-4
lines changed

packages/serverless-offline-sqs/src/index.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ class ServerlessOfflineSQS {
6161

6262
const {sqsEvents, lambdas} = this._getEvents();
6363

64-
this._createLambda(lambdas);
65-
6664
const eventModules = [];
6765

66+
if(lambdas.length > 0){
67+
eventModules.push(this._createLambda(lambdas));
68+
}
69+
6870
if (sqsEvents.length > 0) {
6971
eventModules.push(this._createSqs(sqsEvents));
7072
}
@@ -119,10 +121,17 @@ class ServerlessOfflineSQS {
119121
}
120122
}
121123

122-
_createLambda(lambdas) {
124+
async _createLambda(events, skipStart) {
125+
if(!this.options.host){
126+
this.options.host = 'localhost';
127+
}
123128
this.lambda = new Lambda(this.serverless, this.options);
124129

125-
this.lambda.create(lambdas);
130+
await this.lambda.create(events);
131+
132+
if (!skipStart) {
133+
await this.lambda.start();
134+
}
126135
}
127136

128137
async _createSqs(events, skipStart) {

0 commit comments

Comments
 (0)