MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / fetchStackOutputs

Function fetchStackOutputs

packages/cli/src/commands/lambda/sam.ts:143–183  ·  view source on GitHub ↗
(opts: {
  stackName: string;
  region: string;
  awsProfile?: string;
})

Source from the content-addressed store, hash-verified

141 * Used after `samDeploy` to populate the local state file.
142 */
143export function fetchStackOutputs(opts: {
144 stackName: string;
145 region: string;
146 awsProfile?: string;
147}): StackOutputBag {
148 assertAwsCliAvailable();
149 const args = [
150 "cloudformation",
151 "describe-stacks",
152 "--stack-name",
153 opts.stackName,
154 "--region",
155 opts.region,
156 "--query",
157 "Stacks[0].Outputs",
158 "--output",
159 "json",
160 ];
161 if (opts.awsProfile) {
162 args.unshift("--profile", opts.awsProfile);
163 }
164 const out = execFileSync("aws", args, { encoding: "utf-8" });
165 const parsed = JSON.parse(out) as { OutputKey: string; OutputValue: string }[];
166 const byKey = new Map(parsed.map((o) => [o.OutputKey, o.OutputValue]));
167 const bucketName = byKey.get("RenderBucketName");
168 const functionName = byKey.get("RenderFunctionArn");
169 const stateMachineArn = byKey.get("RenderStateMachineArn");
170 if (!bucketName || !functionName || !stateMachineArn) {
171 throw new Error(
172 `[lambda] stack ${opts.stackName} is missing one of RenderBucketName/RenderFunctionArn/RenderStateMachineArn. Got keys: ${[...byKey.keys()].join(", ")}`,
173 );
174 }
175 return {
176 bucketName,
177 // RenderFunctionArn is the full ARN; the Lambda function name is the
178 // last colon-segment, which downstream `getRenderProgress` calls use
179 // for cost math + CloudWatch lookups.
180 functionName: functionName.split(":").pop() ?? functionName,
181 stateMachineArn,
182 };
183}

Callers 1

runDeployFunction · 0.85

Calls 2

assertAwsCliAvailableFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected