serverless-offline can be an excellent complement to the development process when creating serverless applications without having to deploy them to test on AWS, for instance.
The big problem I've found is with it's memory leaks (not sure if it's with
serverless-offline. If you have use it for rather intensive processes you may have found it tends to break while authorizing or responding multiple requests at the same time. For most of the times it is just a memory allocation problem. So if you, like me, are facing memory problems with serverless offline, this is how you can increase it's node process memory and enjoy a bit more resilience while developing.
node --max-old-space-size=4096 node_modules/serverless/bin/serverless offline start
- Make sure that serverless is installed locally in the project.
- Also using nodejs8.10 as the runtime will make it go smoother: https://forum.serverless.com/t/aws-node-8-10-runtime-for-lambdas-migration-guide/4141
- One last think, if you still get the problems of memory leak, maybe it's your fault, by incorrectly using callbacks and promises: https://github.com/dherault/serverless-offline/issues/434
Some messages you may have been getting:
<--- Last few GCs ---> [60975:0x102801e00] 1801853 ms: Mark-sweep 1393.3 (1468.7) -> 1393.3 (1469.2) MB, 792.2 / 0.0 ms allocation failure GC in old space requested [60975:0x102801e00] 1802586 ms: Mark-sweep 1393.3 (1469.2) -> 1393.3 (1438.2) MB, 732.7 / 0.0 ms last resort GC in old space requested [60975:0x102801e00] 1803468 ms: Mark-sweep 1393.3 (1438.2) -> 1393.3 (1438.2) MB, 882.2 / 0.0 ms last resort GC in old space requested <--- JS stacktrace ---> ==== JS stack trace ========================================= Security context: 0x3fdd9b625ee1 <JSObject> 2: _compile [module.js:~600] [pc=0x37e4c7895d70](this=0x3fdd161211c1 <Module map = 0x3fddafd402c1>,content=0x3fde03e02201 <Very long string>,filename=0x3fdd74cf3839 <String: /Users/walter/Development/<your project>/.webpack/service/src/handlers/environment.js>) 4: .js [module.js:654] [bytecode=0x3fdd1b53c1b1 offset=50](this=0x3fddbf084569 <Object map =...