sst 2.36.4 → 2.36.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -368,6 +368,19 @@ export interface FunctionUrlProps {
368
368
  * ```
369
369
  */
370
370
  cors?: boolean | FunctionUrlCorsProps;
371
+ /**
372
+ * Stream the response payload.
373
+ * @default false
374
+ * * ```js
375
+ * new Function(stack, "Function", {
376
+ * handler: "src/function.handler",
377
+ * url: {
378
+ * streaming: true,
379
+ * },
380
+ * })
381
+ * ```
382
+ */
383
+ streaming?: boolean;
371
384
  }
372
385
  export interface NodeJSProps {
373
386
  /**
@@ -18,7 +18,7 @@ import { VisibleError } from "../error.js";
18
18
  import { useRuntimeHandlers } from "../runtime/handlers.js";
19
19
  import { createAppContext } from "./context.js";
20
20
  import { useWarning } from "./util/warning.js";
21
- import { Architecture, AssetCode, Code, Function as CDKFunction, FunctionUrlAuthType, Handler as CDKHandler, LayerVersion, Runtime as CDKRuntime, Tracing, } from "aws-cdk-lib/aws-lambda";
21
+ import { Architecture, AssetCode, Code, Function as CDKFunction, FunctionUrlAuthType, Handler as CDKHandler, LayerVersion, Runtime as CDKRuntime, Tracing, InvokeMode, } from "aws-cdk-lib/aws-lambda";
22
22
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
23
23
  import { Token, Size as CDKSize, Duration as CDKDuration, IgnoreMode, } from "aws-cdk-lib/core";
24
24
  import { Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
@@ -402,9 +402,11 @@ export class Function extends CDKFunction {
402
402
  }
403
403
  let authType;
404
404
  let cors;
405
+ let streaming;
405
406
  if (url === true) {
406
407
  authType = FunctionUrlAuthType.NONE;
407
408
  cors = true;
409
+ streaming = false;
408
410
  }
409
411
  else {
410
412
  authType =
@@ -412,10 +414,12 @@ export class Function extends CDKFunction {
412
414
  ? FunctionUrlAuthType.AWS_IAM
413
415
  : FunctionUrlAuthType.NONE;
414
416
  cors = url.cors === undefined ? true : url.cors;
417
+ streaming = url.streaming;
415
418
  }
416
419
  this.functionUrl = this.addFunctionUrl({
417
420
  authType,
418
421
  cors: functionUrlCors.buildCorsConfig(cors),
422
+ invokeMode: streaming ? InvokeMode.RESPONSE_STREAM : InvokeMode.BUFFERED,
419
423
  });
420
424
  }
421
425
  disableCloudWatchLogs() {
@@ -2,6 +2,8 @@ import { Token } from "aws-cdk-lib/core";
2
2
  import * as route53 from "aws-cdk-lib/aws-route53";
3
3
  import * as route53Targets from "aws-cdk-lib/aws-route53-targets";
4
4
  import * as acm from "aws-cdk-lib/aws-certificatemanager";
5
+ import { Stack } from "../Stack.js";
6
+ import { DnsValidatedCertificate } from "../cdk/dns-validated-certificate.js";
5
7
  export function buildCustomDomainData(scope, customDomain) {
6
8
  if (customDomain === undefined) {
7
9
  return;
@@ -108,10 +110,17 @@ function lookupHostedZone(scope, hostedZoneDomain) {
108
110
  });
109
111
  }
110
112
  function createCertificate(scope, domainName, hostedZone) {
111
- return new acm.Certificate(scope, "Certificate", {
112
- domainName,
113
- validation: acm.CertificateValidation.fromDns(hostedZone),
114
- });
113
+ const stack = Stack.of(scope);
114
+ return stack.region === "us-east-1"
115
+ ? new acm.Certificate(scope, "Certificate", {
116
+ domainName,
117
+ validation: acm.CertificateValidation.fromDns(hostedZone),
118
+ })
119
+ : new DnsValidatedCertificate(scope, "Certificate", {
120
+ domainName,
121
+ hostedZone,
122
+ region: "us-east-1",
123
+ });
115
124
  }
116
125
  function createRecords(scope, domainName, hostedZone, recordType, cfnDomainName) {
117
126
  // create DNS record
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.36.4",
4
+ "version": "2.36.5",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -120,7 +120,7 @@
120
120
  "@types/ws": "^8.5.3",
121
121
  "@types/yargs": "^17.0.13",
122
122
  "archiver": "^5.3.1",
123
- "astro-sst": "2.36.4",
123
+ "astro-sst": "2.36.5",
124
124
  "async": "^3.2.4",
125
125
  "tsx": "^3.12.1",
126
126
  "typescript": "^5.2.2",