forked from logandk/serverless-wsgi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
873 lines (768 loc) · 25.4 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
"use strict";
const BbPromise = require("bluebird");
const _ = require("lodash");
const path = require("path");
const fse = BbPromise.promisifyAll(require("fs-extra"));
const child_process = require("child_process");
const hasbin = require("hasbin");
const overrideStdoutWrite = require("process-utils/override-stdout-write");
class ServerlessWSGI {
validate() {
return new BbPromise((resolve) => {
let handlersFixed = false;
_.each(this.serverless.service.functions, (func) => {
if (func.handler == "wsgi.handler") {
func.handler = func.handler.replace(
"wsgi.handler",
"wsgi_handler.handler"
);
handlersFixed = true;
}
});
if (handlersFixed) {
this.serverless.cli.log(
'Warning: Please change "wsgi.handler" to "wsgi_handler.handler" in serverless.yml'
);
this.serverless.cli.log(
'Warning: Using "wsgi.handler" still works but has been deprecated and will be removed'
);
this.serverless.cli.log(
"Warning: More information at https://github.com/logandk/serverless-wsgi/issues/84"
);
}
this.enableRequirements = !_.includes(
this.serverless.service.plugins,
"serverless-python-requirements"
);
this.pipArgs = null;
this.appPath = this.serverless.config.servicePath;
if (
this.serverless.service.custom &&
this.serverless.service.custom.wsgi
) {
if (this.serverless.service.custom.wsgi.app) {
this.wsgiApp = this.serverless.service.custom.wsgi.app;
this.appPath = path.dirname(path.join(this.appPath, this.wsgiApp));
}
if (_.isBoolean(this.serverless.service.custom.wsgi.packRequirements)) {
this.enableRequirements =
this.serverless.service.custom.wsgi.packRequirements;
}
this.pipArgs = this.serverless.service.custom.wsgi.pipArgs;
}
if (this.enableRequirements) {
this.requirementsInstallPath = path.join(this.appPath, ".requirements");
}
this.packageRootPath = this.serverless.config.servicePath;
if (
this.serverless.service.package &&
this.serverless.service.package.individually &&
this.serverless.config.servicePath != this.appPath
) {
let handler = _.find(this.serverless.service.functions, (fun) =>
_.includes(fun.handler, "wsgi_handler.handler")
);
// serverless-python-requirements supports packaging individual functions
// by specifying a Python module, in which case the handler needs to be installed
// in the module root, rather than the service root
if (handler && handler.module) {
this.packageRootPath = this.appPath;
this.wsgiApp = path.basename(this.wsgiApp);
}
}
resolve();
});
}
configurePackaging() {
return new BbPromise((resolve) => {
this.serverless.service.package = this.serverless.service.package || {};
this.serverless.service.package.patterns =
this.serverless.service.package.patterns || [];
this.serverless.service.package.patterns = _.union(
this.serverless.service.package.patterns,
_.map(
["wsgi_handler.py", "serverless_wsgi.py", ".serverless-wsgi"],
(artifact) =>
path.join(
path.relative(
this.serverless.config.servicePath,
this.packageRootPath
),
artifact
)
)
);
if (this.enableRequirements) {
this.serverless.service.package.patterns.push(
`!${path.join(
path.relative(this.serverless.config.servicePath, this.appPath),
".requirements/**"
)}`
);
}
resolve();
});
}
locatePython() {
return new BbPromise((resolve) => {
if (
this.serverless.service.custom &&
this.serverless.service.custom.wsgi &&
this.serverless.service.custom.wsgi.pythonBin
) {
this.serverless.cli.log(
`Using Python specified in "pythonBin": ${this.serverless.service.custom.wsgi.pythonBin}`
);
this.pythonBin = this.serverless.service.custom.wsgi.pythonBin;
return resolve();
}
if (this.serverless.service.provider.runtime) {
if (hasbin.sync(this.serverless.service.provider.runtime)) {
this.serverless.cli.log(
`Using Python specified in "runtime": ${this.serverless.service.provider.runtime}`
);
this.pythonBin = this.serverless.service.provider.runtime;
return resolve();
} else {
this.serverless.cli.log(
`Python executable not found for "runtime": ${this.serverless.service.provider.runtime}`
);
}
}
this.serverless.cli.log("Using default Python executable: python");
this.pythonBin = "python";
resolve();
});
}
getWsgiHandlerConfiguration() {
const config = { app: this.wsgiApp };
if (_.isArray(this.serverless.service.custom.wsgi.textMimeTypes)) {
config.text_mime_types =
this.serverless.service.custom.wsgi.textMimeTypes;
}
return config;
}
packWsgiHandler(verbose = true) {
if (!this.wsgiApp) {
this.serverless.cli.log(
"Warning: No WSGI app specified, omitting WSGI handler from package"
);
return BbPromise.resolve();
}
if (verbose) {
this.serverless.cli.log("Packaging Python WSGI handler...");
}
return BbPromise.all([
fse.copyAsync(
path.resolve(__dirname, "wsgi_handler.py"),
path.join(this.packageRootPath, "wsgi_handler.py")
),
fse.copyAsync(
path.resolve(__dirname, "serverless_wsgi.py"),
path.join(this.packageRootPath, "serverless_wsgi.py")
),
fse.writeFileAsync(
path.join(this.packageRootPath, ".serverless-wsgi"),
JSON.stringify(this.getWsgiHandlerConfiguration())
),
]);
}
packRequirements() {
return new BbPromise((resolve, reject) => {
if (!this.enableRequirements) {
return resolve();
}
let args = [path.resolve(__dirname, "requirements.py")];
if (this.pipArgs) {
args.push("--pip-args");
args.push(this.pipArgs);
}
if (this.wsgiApp) {
args.push(path.resolve(__dirname, "requirements.txt"));
}
const requirementsFile = path.join(this.appPath, "requirements.txt");
if (fse.existsSync(requirementsFile)) {
args.push(requirementsFile);
} else {
if (!this.wsgiApp) {
return resolve();
}
}
args.push(this.requirementsInstallPath);
this.serverless.cli.log("Packaging required Python packages...");
const res = child_process.spawnSync(this.pythonBin, args, {
encoding: "utf8",
});
if (res.error) {
if (res.error.code == "ENOENT") {
return reject(
`Unable to run Python executable: ${this.pythonBin}. Use the "pythonBin" option to set your Python executable explicitly.`
);
} else {
return reject(res.error);
}
}
if (res.status != 0) {
return reject(res.stderr);
}
resolve();
});
}
linkRequirements() {
return new BbPromise((resolve, reject) => {
if (!this.enableRequirements) {
return resolve();
}
if (fse.existsSync(this.requirementsInstallPath)) {
this.serverless.cli.log("Linking required Python packages...");
fse.readdirSync(this.requirementsInstallPath).map((file) => {
let relativePath = path.join(
path.relative(this.serverless.config.servicePath, this.appPath),
file
);
this.serverless.service.package.patterns.push(relativePath);
this.serverless.service.package.patterns.push(`${relativePath}/**`);
try {
fse.symlinkSync(`${this.requirementsInstallPath}/${file}`, file);
} catch (exception) {
let linkConflict = false;
try {
linkConflict =
fse.readlinkSync(file) !==
`${this.requirementsInstallPath}/${file}`;
} catch (e) {
linkConflict = true;
}
if (linkConflict) {
return reject(
`Unable to link dependency '${file}' ` +
"because a file by the same name exists in this service"
);
}
}
});
}
resolve();
});
}
checkWerkzeugPresent() {
return new BbPromise((resolve) => {
if (!this.wsgiApp || !this.enableRequirements) {
return resolve();
}
const hasWerkzeug = _.includes(fse.readdirSync(this.appPath), "werkzeug");
if (!hasWerkzeug) {
this.serverless.cli.log(
"Warning: Could not find werkzeug, please add it to your requirements.txt"
);
}
resolve();
});
}
unlinkRequirements() {
return new BbPromise((resolve) => {
if (!this.enableRequirements) {
return resolve();
}
if (fse.existsSync(this.requirementsInstallPath)) {
this.serverless.cli.log("Unlinking required Python packages...");
fse.readdirSync(this.requirementsInstallPath).map((file) => {
if (fse.existsSync(file)) {
fse.unlinkSync(file);
}
});
}
resolve();
});
}
cleanRequirements() {
if (!this.enableRequirements) {
return BbPromise.resolve();
}
return fse.removeAsync(this.requirementsInstallPath);
}
cleanup() {
const artifacts = [
"wsgi_handler.py",
"serverless_wsgi.py",
".serverless-wsgi",
];
return BbPromise.all(
_.map(artifacts, (artifact) =>
fse.removeAsync(path.join(this.packageRootPath, artifact))
)
);
}
loadEnvVars() {
return new BbPromise((resolve) => {
const providerEnvVars = _.omitBy(
this.serverless.service.provider.environment || {},
_.isObject
);
_.merge(process.env, providerEnvVars);
_.each(this.serverless.service.functions, (func) => {
if (_.includes(func.handler, "wsgi_handler.handler")) {
const functionEnvVars = _.omitBy(func.environment || {}, _.isObject);
_.merge(process.env, functionEnvVars);
}
});
resolve();
});
}
serve() {
return new BbPromise((resolve, reject) => {
if (!this.wsgiApp) {
return reject(
'Missing WSGI app, please specify custom.wsgi.app. For instance, if you have a Flask application "app" in "api.py", set the Serverless custom.wsgi.app configuration option to: api.app'
);
}
const port = this.options.port || 5000;
const host = this.options.host || "localhost";
const disable_threading = this.options["disable-threading"] || false;
const num_processes = this.options["num-processes"] || 1;
const ssl = this.options.ssl || false;
const ssl_pub = this.options["ssl-pub"] || "";
const ssl_pri = this.options["ssl-pri"] || "";
var args = [
path.resolve(__dirname, "serve.py"),
this.packageRootPath,
this.wsgiApp,
port,
host,
];
if (num_processes > 1) {
args.push("--num-processes", num_processes);
}
if (disable_threading) {
args.push("--disable-threading");
}
if (ssl) {
args.push("--ssl");
}
if (ssl_pub) {
args.push("--ssl-pub", ssl_pub);
}
if (ssl_pri) {
args.push("--ssl-pri", ssl_pri);
}
var status = child_process.spawnSync(this.pythonBin, args, {
stdio: "inherit",
});
if (status.error) {
if (status.error.code == "ENOENT") {
reject(
`Unable to run Python executable: ${this.pythonBin}. Use the "pythonBin" option to set your Python executable explicitly.`
);
} else {
reject(status.error);
}
} else {
resolve();
}
});
}
findHandler() {
return _.findKey(this.serverless.service.functions, (fun) =>
_.includes(fun.handler, "wsgi_handler.handler")
);
}
invokeHandler(command, data, local) {
const handlerFunction = this.findHandler();
if (!handlerFunction) {
return BbPromise.reject(
"No functions were found with handler: wsgi_handler.handler"
);
}
// We're going to call the provider-agnostic invoke plugin, which has
// no proper plugin-facing API. Instead, the current CLI options are modified
// to match those of an invoke call.
this.serverless.pluginManager.cliOptions.function = handlerFunction;
this.options.function = handlerFunction;
this.options.data = JSON.stringify({
"_serverless-wsgi": {
command: command,
data: data,
},
});
this.serverless.pluginManager.cliOptions.data = JSON.stringify({
"_serverless-wsgi": {
command: command,
data: data,
},
});
this.serverless.pluginManager.cliOptions.context = undefined;
this.serverless.pluginManager.cliOptions.f =
this.serverless.pluginManager.cliOptions.function;
this.serverless.pluginManager.cliOptions.d =
this.serverless.pluginManager.cliOptions.data;
this.serverless.pluginManager.cliOptions.c =
this.serverless.pluginManager.cliOptions.context;
this.options.context = undefined;
this.options.f = this.options.function;
this.options.d = this.options.data;
this.options.c = this.options.context;
// The invoke plugin prints the response to the console as JSON. When invoking commands
// remotely, we get a string back and we want it to appear in the console as it would have
// if it was invoked locally.
//
// Thus, console.log is temporarily hijacked to capture the output and parse it as JSON. This
// hack is needed to avoid having to call the provider-specific invoke plugins.
let output = "";
/* eslint-disable no-console */
const native_log = console.log;
console.log = (msg) => (output += msg + "\n");
/* eslint-disable no-unused-vars */
const {
originalStdoutWrite, // Original `write` bound to `process.stdout`#noqa
originalWrite, // Original `write` on its own
restoreStdoutWrite, // Allows to restore previous state
} = overrideStdoutWrite(
// process.stdout.write replacement
(
orig, // data input
originalStdoutWrite // // Original `write` bound to `process.stdout`
) => {
// Example of filtering ANSI codes for original stdout.write
originalStdoutWrite(orig.replace(/["]+/g, "").replace(/\\n/g, "\n"));
// originalStdoutWrite(orig.substring(orig.indexOf(",") + 7).replace(/\\n/g,"\n") + "\n");
}
);
/* eslint-enable no-unused-vars */
return this.serverless.pluginManager
.run(local ? ["invoke", "local"] : ["invoke"])
.then(
() =>
new BbPromise((resolve, reject) => {
output = _.trimEnd(output, "\n");
try {
output = JSON.parse(output);
} catch (e) {
// Swallow exception
}
if (_.isArray(output) && output.length == 2) {
const return_code = output[0];
const output_data = _.isString(output[1])
? _.trimEnd(output[1], "\n")
: output[1];
if (return_code == 0) {
native_log(output_data);
} else {
return reject(output_data);
}
} else {
native_log(output);
}
return resolve();
})
)
.finally(() => {
console.log = native_log;
});
/* eslint-enable no-console */
}
command(local) {
let data = null;
if (this.options.command) {
data = this.options.command;
} else if (this.options.file) {
data = fse.readFileSync(this.options.file, "utf8");
} else {
return BbPromise.reject(
"Please provide either a command (-c) or a file (-f)"
);
}
return this.invokeHandler("command", data, local);
}
exec(local) {
let data = null;
if (this.options.command) {
data = this.options.command;
} else if (this.options.file) {
data = fse.readFileSync(this.options.file, "utf8");
} else {
return BbPromise.reject(
"Please provide either a command (-c) or a file (-f)"
);
}
return this.invokeHandler("exec", data, local);
}
manage(local) {
return this.invokeHandler("manage", this.options.command, local);
}
flask(local) {
return this.invokeHandler("flask", this.options.command, local);
}
constructor(serverless, options) {
this.serverless = serverless;
this.options = options;
this.commands = {
wsgi: {
usage: "Deploy Python WSGI applications",
lifecycleEvents: ["wsgi"],
commands: {
serve: {
usage: "Serve the WSGI application locally",
lifecycleEvents: ["serve"],
options: {
port: {
type: "string",
usage: "Local server port, defaults to 5000",
shortcut: "p",
},
host: {
type: "string",
usage: "Server host, defaults to 'localhost'",
},
"disable-threading": {
type: "boolean",
usage: "Disables multi-threaded mode",
},
"num-processes": {
type: "string",
usage: "Number of processes for server, defaults to 1",
},
ssl: {
type: "boolean",
usage: "Enable local serving using HTTPS",
},
"ssl-pub": {
type: "string",
usage: "local ssl pem file to use for ssl",
},
"ssl-pri": {
type: "string",
usage: "local ssl pem file to use for ssl private key",
},
},
},
install: {
usage: "Install WSGI handler and requirements for local use",
lifecycleEvents: ["install"],
},
clean: {
usage: "Remove cached requirements",
lifecycleEvents: ["clean"],
},
command: {
usage: "Execute shell commands or scripts remotely",
lifecycleEvents: ["command"],
options: {
command: {
type: "string",
usage: "Command to execute",
shortcut: "c",
},
file: {
type: "string",
usage: "Path to a shell script to execute",
shortcut: "f",
},
},
commands: {
local: {
usage: "Execute shell commands or scripts locally",
lifecycleEvents: ["command"],
options: {
command: {
type: "string",
usage: "Command to execute",
shortcut: "c",
},
file: {
type: "string",
usage: "Path to a shell script to execute",
shortcut: "f",
},
},
},
},
},
exec: {
usage: "Evaluate Python code remotely",
lifecycleEvents: ["exec"],
options: {
command: {
type: "string",
usage: "Python code to execute",
shortcut: "c",
},
file: {
type: "string",
usage: "Path to a Python script to execute",
shortcut: "f",
},
},
commands: {
local: {
usage: "Evaluate Python code locally",
lifecycleEvents: ["exec"],
options: {
command: {
type: "string",
usage: "Python code to execute",
shortcut: "c",
},
file: {
type: "string",
usage: "Path to a Python script to execute",
shortcut: "f",
},
},
},
},
},
manage: {
usage: "Run Django management commands remotely",
lifecycleEvents: ["manage"],
options: {
command: {
type: "string",
usage: "Management command",
shortcut: "c",
required: true,
},
},
commands: {
local: {
usage: "Run Django management commands locally",
lifecycleEvents: ["manage"],
options: {
command: {
type: "string",
usage: "Management command",
shortcut: "c",
required: true,
},
},
},
},
},
flask: {
usage: "Run Flask CLI commands remotely",
lifecycleEvents: ["flask"],
options: {
command: {
type: "string",
usage: "Flask CLI command",
shortcut: "c",
required: true,
},
},
commands: {
local: {
usage: "Run Flask CLI commands locally",
lifecycleEvents: ["flask"],
options: {
command: {
type: "string",
usage: "Flask CLI command",
shortcut: "c",
required: true,
},
},
},
},
},
},
},
};
const deployBeforeHook = () =>
BbPromise.bind(this)
.then(this.validate)
.then(this.configurePackaging)
.then(this.locatePython)
.then(this.packWsgiHandler)
.then(this.packRequirements)
.then(this.linkRequirements)
.then(this.checkWerkzeugPresent);
const deployBeforeHookWithoutHandler = () =>
BbPromise.bind(this)
.then(this.validate)
.then(this.configurePackaging)
.then(this.locatePython)
.then(this.packRequirements)
.then(this.linkRequirements);
const deployAfterHook = () =>
BbPromise.bind(this)
.then(this.validate)
.then(this.unlinkRequirements)
.then(this.cleanup);
this.hooks = {
"wsgi:wsgi": () => {
this.serverless.cli.generateCommandsHelp(["wsgi"]);
return BbPromise.resolve();
},
"wsgi:serve:serve": () =>
BbPromise.bind(this)
.then(this.validate)
.then(this.locatePython)
.then(this.loadEnvVars)
.then(this.serve),
"wsgi:install:install": deployBeforeHook,
"wsgi:command:command": () =>
BbPromise.bind(this)
.then(this.validate)
.then(() => this.command(false)),
"wsgi:command:local:command": () =>
BbPromise.bind(this)
.then(this.validate)
.then(() => this.command(true)),
"wsgi:exec:exec": () =>
BbPromise.bind(this)
.then(this.validate)
.then(() => this.exec(false)),
"wsgi:exec:local:exec": () =>
BbPromise.bind(this)
.then(this.validate)
.then(() => this.exec(true)),
"wsgi:manage:manage": () =>
BbPromise.bind(this)
.then(this.validate)
.then(() => this.manage(false)),
"wsgi:manage:local:manage": () =>
BbPromise.bind(this)
.then(this.validate)
.then(() => this.manage(true)),
"wsgi:flask:flask": () =>
BbPromise.bind(this)
.then(this.validate)
.then(() => this.flask(false)),
"wsgi:flask:local:flask": () =>
BbPromise.bind(this)
.then(this.validate)
.then(() => this.flask(true)),
"wsgi:clean:clean": () => deployAfterHook().then(this.cleanRequirements),
"before:package:createDeploymentArtifacts": deployBeforeHook,
"after:package:createDeploymentArtifacts": deployAfterHook,
"before:deploy:function:packageFunction": () => {
if (
_.includes(this.options.functionObj.handler, "wsgi_handler.handler")
) {
return deployBeforeHook();
} else {
return deployBeforeHookWithoutHandler();
}
},
"after:deploy:function:packageFunction": deployAfterHook,
"before:offline:start:init": deployBeforeHook,
"after:offline:start:end": deployAfterHook,
"before:invoke:local:invoke": () => {
const functionObj = this.serverless.service.getFunction(
this.options.function
);
return BbPromise.bind(this)
.then(this.validate)
.then(() => {
if (_.includes(functionObj.handler, "wsgi_handler.handler")) {
return this.packWsgiHandler(false);
} else {
return BbPromise.resolve();
}
});
},
"after:invoke:local:invoke": () =>
BbPromise.bind(this).then(this.validate).then(this.cleanup),
};
}
}
module.exports = ServerlessWSGI;