serverless-localstack icon indicating copy to clipboard operation
serverless-localstack copied to clipboard

when autostart is true, localstack tries to start docker container even when stage is not supported/enabled for localstack

Open akinboboye opened this issue 4 years ago • 1 comments
trafficstars

image custom.localstack.autostart is set to true and custom.localstack.stages is set ['local'].

Ideally with this config, localstack should only attempt to autostart the docker container when the stage i am deploying to is included in custom.localstack.stages. But that is not the case, localstack always tries to start the container whether the plugin is enabled for the stage or not.

I think their should be a check to see if localstack is enabled for the stage or not before attempting to autostart

akinboboye avatar Jun 19 '21 08:06 akinboboye

My setup does not have autostart set to true, But despite that even when the stage is not local, Localstack is running at the time of deployment for version 0.4.32, and I get the following error

$ /codebuild/output/src743868393/src/node_modules/.bin/sls deploy -v
--
45 |  
46 | Error ---------------------------------------------------
47 |  
48 | Error: When mounting Lambda code, you must retain webpack output directory. Set custom.webpack.keepOutputDirectory to true.
49 | at new LocalstackPlugin (/codebuild/output/src743868393/src/node_modules/serverless-localstack/src/index.js:132:15)
50 | at PluginManager.addPlugin (/codebuild/output/src743868393/src/node_modules/serverless/lib/classes/PluginManager.js:112:28)
51 | at /codebuild/output/src743868393/src/node_modules/serverless/lib/classes/PluginManager.js:158:33
52 | at Array.forEach (<anonymous>)
53 | at PluginManager.loadAllPlugins (/codebuild/output/src743868393/src/node_modules/serverless/lib/classes/PluginManager.js:158:8)
54 | at Serverless.init (/codebuild/output/src743868393/src/node_modules/serverless/lib/Serverless.js:206:30)
55 | at processTicksAndRejections (internal/process/task_queues.js:93:5)
56 | at async /codebuild/output/src743868393/src/node_modules/serverless/scripts/serverless.js:442:7
57 |  
58 | For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

With the versions mentioned below, everything works as expected.

"serverless": "2.48.0"
"serverless-localstack": "0.4.28"
"serverless-webpack": "5.5.1"

aishwarya257 avatar Jun 24 '21 07:06 aishwarya257

Hi @aishwarya257, hi @akinboboye, thanks for your report! We have fixed this issue in v1.2.0. Please let us know if you still encounter any issues.

steffyP avatar Jan 29 '24 09:01 steffyP