Skip to content

Commit

Permalink
chore: debug cfn outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ap0nia committed Jul 15, 2023
1 parent e296f98 commit e5e03c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ant.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class MyStack extends Stack {
new GitHub(this, "GitHub", {
outputs: {
invokeUrl: {
value: api.api.arnForExecuteApi(),
value: api.api.urlForPath(),
},
},
callbacks: {
Expand Down
12 changes: 7 additions & 5 deletions packages/ant-stack/src/cdk/constructs/GitHub/GitHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,28 @@ export class GitHub<T extends Outputs = Outputs> extends Construct {
this.stackName = Stack.of(this).stackName;

this.outputs = Object.entries(config.outputs ?? {}).reduce((outputs, [key, value]) => {
outputs[key] = new CfnOutput(this, key, value);
outputs[key] = new CfnOutput(scope, key, value);
return outputs;
}, {} as Record<PropertyKey, CfnOutput>);
}

public parseOutputs(): JsonFrom<T> {
try {
console.log("output file: ", this.outputsFile);
console.log("outputs file: ", this.outputsFile);

const fileContents = fs.readFileSync(this.outputsFile, "utf-8");

console.log("fileContents: ", fileContents);
console.log("file contents: ", fileContents);

const json = JSON.parse(fileContents);

console.log("json: ", json);

console.log("stack name: ", this.stackName);

return json[this.stackName];
} catch {
console.log(`Failed to parse outputs file at ${this.outputsFile}.`);
} catch (e) {
console.log(`Error: ${e}. Failed to parse outputs file at ${this.outputsFile}.`);
return {} as JsonFrom<T>;
}
}
Expand Down

0 comments on commit e5e03c7

Please sign in to comment.