@@ -185,23 +185,26 @@ private function retrieveOutputs(string $environment, array $awsCredentials, ?st
185185 // If plugins add extra output afterward, it should be ignored.
186186 $ outputsResults = preg_match ('/Stack Outputs:\n(( {2}[ \S]+\n)+)/ ' , $ infoOutput , $ matches );
187187 // Also try to extract the stack name and region
188- $ stackResults = preg_match ('/stack: (.*)\n/ ' , $ infoOutput , $ matches );
189- $ regionResults = preg_match ('/region: (.*)\n/ ' , $ infoOutput , $ matches );
188+ $ stackResults = preg_match ('/stack: (.*)\n/ ' , $ infoOutput , $ stackMatches );
189+ $ regionResults = preg_match ('/region: (.*)\n/ ' , $ infoOutput , $ regionMatches );
190190 if ($ outputsResults && $ stackResults && $ regionResults ) {
191191 try {
192192 $ stackOutputs = Yaml::parse ($ matches [1 ]);
193193 if (! is_array ($ stackOutputs )) {
194194 throw new Exception ('Invalid stack outputs in the "serverless info" output ' );
195195 }
196196 $ stackOutputs = $ this ->cleanupCfOutputs ($ stackOutputs );
197- $ stackName = $ matches [2 ];
197+
198+ $ stackName = $ stackMatches [1 ];
198199 if (! is_string ($ stackName )) {
199200 throw new Exception ('Invalid stack name in the "serverless info" output ' );
200201 }
201- $ region = $ matches [3 ];
202+
203+ $ region = $ regionMatches [1 ];
202204 if (! is_string ($ region )) {
203205 throw new Exception ('Invalid region in the "serverless info" output ' );
204206 }
207+
205208 return array_merge ([
206209 'stack ' => $ stackName ,
207210 'region ' => $ region ,
0 commit comments