Skip to content

Commit faaee5c

Browse files
authored
fix(infra): fail deployments if something goes wrong (#2410)
* fix(infra): fail deployments if something goes wrong * fix(infra): remove failing logic * fix(infra): need to have at least 1 key not 2
1 parent 67aff51 commit faaee5c

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

packages/_infra/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,7 @@ async function main(): Promise<void> {
7575
new CogBuilderStack(basemaps, 'CogBuilder', { env: { region: BaseMapsRegion, account } });
7676
}
7777

78-
main().catch((e) => console.error(e));
78+
main().catch((e) => {
79+
console.error(e);
80+
process.exit(1);
81+
});

packages/_infra/src/parameters.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ export interface ParametersEdge {
77
}
88

99
export interface ParametersServe {
10-
LambdaXyzAlb: string;
1110
LambdaXyzUrl: string;
12-
LambdaXyzDns: string;
1311
}
1412
export const ParametersServeKeys: Record<keyof ParametersServe, string> = {
15-
LambdaXyzAlb: 'LambdaXyzAlb',
1613
LambdaXyzUrl: 'LambdaXyzUrl',
17-
LambdaXyzDns: 'LambdaXyzDns',
1814
};
1915

2016
export const ParametersEdgeKeys: Record<keyof ParametersEdge, string> = {
@@ -53,6 +49,7 @@ export async function getParameters<T extends ParameterKeys>(
5349

5450
output[param as keyof T] = edgeParam as any;
5551
}
56-
if (Object.keys(output).length > 1) return output as T;
52+
53+
if (Object.keys(output).length > 0) return output as T;
5754
return null;
5855
}

packages/_infra/src/serve/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export class ServeStack extends cdk.Stack {
2121

2222
const lambda = new LambdaTiler(this, 'LambdaTiler', { staticBucketName: props.staticBucketName });
2323
const table = new TileMetadataTable(this, 'TileMetadata');
24-
table.table.grantReadData(lambda.lambdaVpc);
2524
table.table.grantReadData(lambda.lambdaNoVpc);
2625

2726
new cdk.CfnOutput(this, ParametersServeKeys.LambdaXyzUrl, { value: lambda.functionUrl.url });

packages/_infra/src/serve/lambda.tiler.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ export interface LambdaTilerProps {
1717
* Create a API Key validation edge lambda
1818
*/
1919
export class LambdaTiler extends Construct {
20-
public lambda: lambda.Function[];
2120
public version: lambda.Version;
2221
public functionUrl: lambda.FunctionUrl;
2322

2423
public lambdaNoVpc: lambda.Function;
25-
public lambdaVpc: lambda.Function;
2624

2725
public constructor(scope: cdk.Stack, id: string, props: LambdaTilerProps) {
2826
super(scope, id);
@@ -61,13 +59,11 @@ export class LambdaTiler extends Construct {
6159
if (props.staticBucketName) {
6260
const staticBucket = s3.Bucket.fromBucketName(this, 'StaticBucket', props.staticBucketName);
6361
staticBucket.grantRead(this.lambdaNoVpc);
64-
staticBucket.grantRead(this.lambdaVpc);
6562
}
6663

6764
for (const bucketName of config.CogBucket) {
6865
const cogBucket = s3.Bucket.fromBucketName(this, `CogBucket${bucketName}`, bucketName);
6966
cogBucket.grantRead(this.lambdaNoVpc);
70-
cogBucket.grantRead(this.lambdaVpc);
7167
}
7268
}
7369
}

0 commit comments

Comments
 (0)