Skip to content

Commit 74aaa2f

Browse files
author
justin.kruse
authored
update referenced file name due to change with serverless offline upgrade (#2)
1 parent 191f6f1 commit 74aaa2f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,19 @@ const evalInContext = require('./eval')
1313
const createMQTTBroker = require('./broker')
1414
// TODO: send PR to serverless-offline to export this
1515
const functionHelper = require('serverless-offline/src/functionHelper')
16-
const createLambdaContext = require('serverless-offline/src/createLambdaContext')
16+
let createLambdaContext;
17+
18+
try {
19+
createLambdaContext = require('serverless-offline/src/createLambdaContext');
20+
} catch (e) {
21+
try {
22+
// latest serverless-offline changed the file name
23+
createLambdaContext = require('serverless-offline/src/LambdaContext');
24+
} catch (e2) {
25+
throw new Error('Unable to find LambdaContext file');
26+
}
27+
}
28+
1729
const VERBOSE = typeof process.env.SLS_DEBUG !== 'undefined'
1830
const defaultOpts = {
1931
host: 'localhost',

0 commit comments

Comments
 (0)