Skip to content

Commit 75cc134

Browse files
author
Frank
committed
Site: fix sst-env missing url type in dev mode
1 parent 68b612f commit 75cc134

2 files changed

Lines changed: 52 additions & 54 deletions

File tree

platform/src/components/aws/ssr-site.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,9 +1366,8 @@ async function handler(event) {
13661366
*/
13671367
public get url() {
13681368
return all([this.cdn, this.devUrl]).apply(([cdn, dev]) => {
1369-
if (!cdn) return;
1370-
return all([cdn.domainUrl, cdn.url]).apply(
1371-
([domainUrl, url]) => domainUrl ?? url ?? dev!,
1369+
return all([cdn?.domainUrl, cdn?.url]).apply(
1370+
([domainUrl, url]) => domainUrl ?? url ?? dev,
13721371
);
13731372
});
13741373
}

platform/src/components/aws/static-site.ts

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -428,46 +428,46 @@ export interface StaticSiteArgs extends BaseStaticSiteArgs {
428428
invalidation?: Input<
429429
| false
430430
| {
431-
/**
432-
* Configure if `sst deploy` should wait for the CloudFront cache invalidation to finish.
433-
*
434-
* :::tip
435-
* For non-prod environments it might make sense to pass in `false`.
436-
* :::
437-
*
438-
* Waiting for the CloudFront cache invalidation process to finish ensures that the new content will be served once the deploy finishes. However, this process can sometimes take more than 5 mins.
439-
* @default `false`
440-
* @example
441-
* ```js
442-
* {
443-
* invalidation: {
444-
* wait: true
445-
* }
446-
* }
447-
* ```
448-
*/
449-
wait?: Input<boolean>;
450-
/**
451-
* The paths to invalidate.
452-
*
453-
* You can either pass in an array of glob patterns to invalidate specific files. Or you can use the built-in option `all` to invalidation all files when any file changes.
454-
*
455-
* :::note
456-
* Invalidating `all` counts as one invalidation, while each glob pattern counts as a single invalidation path.
457-
* :::
458-
* @default `"all"`
459-
* @example
460-
* Invalidate the `index.html` and all files under the `products/` route.
461-
* ```js
462-
* {
463-
* invalidation: {
464-
* paths: ["/index.html", "/products/*"]
465-
* }
466-
* }
467-
* ```
468-
*/
469-
paths?: Input<"all" | string[]>;
470-
}
431+
/**
432+
* Configure if `sst deploy` should wait for the CloudFront cache invalidation to finish.
433+
*
434+
* :::tip
435+
* For non-prod environments it might make sense to pass in `false`.
436+
* :::
437+
*
438+
* Waiting for the CloudFront cache invalidation process to finish ensures that the new content will be served once the deploy finishes. However, this process can sometimes take more than 5 mins.
439+
* @default `false`
440+
* @example
441+
* ```js
442+
* {
443+
* invalidation: {
444+
* wait: true
445+
* }
446+
* }
447+
* ```
448+
*/
449+
wait?: Input<boolean>;
450+
/**
451+
* The paths to invalidate.
452+
*
453+
* You can either pass in an array of glob patterns to invalidate specific files. Or you can use the built-in option `all` to invalidation all files when any file changes.
454+
*
455+
* :::note
456+
* Invalidating `all` counts as one invalidation, while each glob pattern counts as a single invalidation path.
457+
* :::
458+
* @default `"all"`
459+
* @example
460+
* Invalidate the `index.html` and all files under the `products/` route.
461+
* ```js
462+
* {
463+
* invalidation: {
464+
* paths: ["/index.html", "/products/*"]
465+
* }
466+
* }
467+
* ```
468+
*/
469+
paths?: Input<"all" | string[]>;
470+
}
471471
>;
472472
/**
473473
* By default, a standalone CloudFront distribution is created.
@@ -655,10 +655,10 @@ export class StaticSite extends Component implements Link.Linkable {
655655
invalidation: Output<
656656
| false
657657
| {
658-
paths: string[];
659-
version: string;
660-
wait: boolean;
661-
}
658+
paths: string[];
659+
version: string;
660+
wait: boolean;
661+
}
662662
>;
663663
invalidationDependsOn: Input<Resource>[];
664664
};
@@ -940,8 +940,8 @@ async function handler(event) {
940940
...args.assets,
941941
path: args.assets?.path
942942
? output(args.assets?.path).apply((v) =>
943-
v.replace(/^\//, "").replace(/\/$/, ""),
944-
)
943+
v.replace(/^\//, "").replace(/\/$/, ""),
944+
)
945945
: undefined,
946946
purge: output(args.assets?.purge ?? true),
947947
};
@@ -964,8 +964,8 @@ async function handler(event) {
964964
const s3Bucket = bucket
965965
? bucket.nodes.bucket
966966
: s3.BucketV2.get(`${name}Assets`, assets.bucket!, undefined, {
967-
parent,
968-
});
967+
parent,
968+
});
969969

970970
return {
971971
bucketName: s3Bucket.bucket,
@@ -1113,9 +1113,8 @@ async function handler(event) {
11131113
*/
11141114
public get url() {
11151115
return all([this.cdn, this.devUrl]).apply(([cdn, dev]) => {
1116-
if (!cdn) return;
1117-
return all([cdn.domainUrl, cdn.url]).apply(
1118-
([domainUrl, url]) => domainUrl ?? url ?? dev!,
1116+
return all([cdn?.domainUrl, cdn?.url]).apply(
1117+
([domainUrl, url]) => domainUrl ?? url ?? dev,
11191118
);
11201119
});
11211120
}

0 commit comments

Comments
 (0)