sst 2.28.0 → 2.28.1

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.
@@ -288,7 +288,7 @@ export async function useLocalServer(opts) {
288
288
  id: invocation.id,
289
289
  error: evt.properties.errorType,
290
290
  message: evt.properties.errorMessage,
291
- stack: evt.properties.trace.map((t) => ({
291
+ stack: (evt.properties.trace || []).map((t) => ({
292
292
  raw: t,
293
293
  })),
294
294
  });
@@ -11,6 +11,7 @@ export interface AstroSiteProps extends SsrSiteProps {
11
11
  * - "?" matches exactly 1 character.
12
12
  *
13
13
  * Matched routes will be handled directly by the server function.
14
+ * @deprecated Define `serverRoutes` in `astro.config.mjs` instead.
14
15
  * @default true
15
16
  * @example
16
17
  * ```js
@@ -25,17 +26,6 @@ export interface AstroSiteProps extends SsrSiteProps {
25
26
  * ```
26
27
  */
27
28
  serverRoutes?: string[];
28
- /**
29
- * Supports [streaming](https://docs.astro.build/en/guides/server-side-rendering/#using-streaming-to-improve-page-performance) responses.
30
- * @default true
31
- * @example
32
- * ```js
33
- * regional: {
34
- * streaming: false,
35
- * }
36
- * ```
37
- */
38
- streaming?: boolean;
39
29
  };
40
30
  }
41
31
  type AstroSiteNormalizedProps = AstroSiteProps & SsrSiteNormalizedProps;
@@ -40,7 +40,6 @@ export class AstroSite extends SsrSite {
40
40
  },
41
41
  ],
42
42
  regional: {
43
- streaming: props?.regional?.streaming ?? true,
44
43
  ...props?.regional,
45
44
  },
46
45
  });
@@ -158,7 +157,7 @@ export class AstroSite extends SsrSite {
158
157
  type: "function",
159
158
  constructId: "ServerFunction",
160
159
  function: serverConfig,
161
- streaming: regional?.streaming,
160
+ streaming: buildMeta.responseMode === "stream",
162
161
  };
163
162
  plan.origins.fallthroughServer = {
164
163
  type: "group",
@@ -175,7 +174,7 @@ export class AstroSite extends SsrSite {
175
174
  cacheType: "static",
176
175
  pattern: `${buildMeta.clientBuildVersionedSubDir}/*`,
177
176
  origin: "staticsServer",
178
- }, ...(regional?.serverRoutes ?? []).map((route) => ({
177
+ }, ...(buildMeta.serverRoutes ?? regional?.serverRoutes ?? []).map((route) => ({
179
178
  cacheType: "server",
180
179
  pattern: route,
181
180
  origin: "regionalServer",
@@ -270,7 +270,7 @@ export interface FunctionProps extends Omit<FunctionOptions, "functionName" | "m
270
270
  *
271
271
  * Note that, if a Layer is created in a stack (say `stackA`) and is referenced in another stack (say `stackB`), SST automatically creates an SSM parameter in `stackA` with the Layer's ARN. And in `stackB`, SST reads the ARN from the SSM parameter, and then imports the Layer.
272
272
  *
273
- * This is to get around the limitation that a Lambda Layer ARN cannot be referenced across stacks via a stack export. The Layer ARN contains a version number that is incremented everytime the Layer is modified. When you refer to a Layer's ARN across stacks, a CloudFormation export is created. However, CloudFormation does not allow an exported value to be updated. Once exported, if you try to deploy the updated layer, the CloudFormation update will fail. You can read more about this issue here - https://github.com/sst/sst/issues/549.
273
+ * This is to get around the limitation that a Lambda Layer ARN cannot be referenced across stacks via a stack export. The Layer ARN contains a version number that is incremented everytime the Layer is modified. When you refer to a Layer's ARN across stacks, a CloudFormation export is created. However, CloudFormation does not allow an exported value to be updated. Once exported, if you try to deploy the updated layer, the CloudFormation update will fail. You can read more about this issue here - https://github.com/sst/sst/issues/549.
274
274
  *
275
275
  * @default no layers
276
276
  *
@@ -282,6 +282,21 @@ export interface FunctionProps extends Omit<FunctionOptions, "functionName" | "m
282
282
  * ```
283
283
  */
284
284
  layers?: (string | ILayerVersion)[];
285
+ /**
286
+ * Disable sending function logs to CloudWatch Logs.
287
+ *
288
+ * Note that, logs will still appear locally when running `sst dev`.
289
+ * @default false
290
+ * @example
291
+ * ```js
292
+ * new Function(stack, "Function", {
293
+ * handler: "src/function.handler",
294
+ * disableCloudWatchLogs: true
295
+ * })
296
+ * ```
297
+ *
298
+ */
299
+ disableCloudWatchLogs?: boolean;
285
300
  /**
286
301
  * The duration function logs are kept in CloudWatch Logs.
287
302
  *
@@ -662,6 +677,7 @@ export declare class Function extends CDKFunction implements SSTConstruct {
662
677
  /** @internal */
663
678
  getFunctionBinding(): FunctionBindingProps;
664
679
  private createUrl;
680
+ private disableCloudWatchLogs;
665
681
  private isNodeRuntime;
666
682
  static validateHandlerSet(id: string, props: FunctionProps): void;
667
683
  static validateVpcSettings(id: string, props: FunctionProps): void;
@@ -294,7 +294,6 @@ export class Function extends CDKFunction {
294
294
  removeInEdge: true,
295
295
  });
296
296
  }
297
- // Attach permissions
298
297
  this.attachPermissions(props.permissions || []);
299
298
  // Add config
300
299
  this.addEnvironment("SST_APP", app.name, { removeInEdge: true });
@@ -303,6 +302,7 @@ export class Function extends CDKFunction {
303
302
  removeInEdge: true,
304
303
  });
305
304
  this.bind(props.bind || []);
305
+ this.disableCloudWatchLogs();
306
306
  this.createUrl();
307
307
  this._isLiveDevEnabled = isLiveDevEnabled;
308
308
  useFunctions().add(this.node.addr, props);
@@ -415,6 +415,22 @@ export class Function extends CDKFunction {
415
415
  cors: functionUrlCors.buildCorsConfig(cors),
416
416
  });
417
417
  }
418
+ disableCloudWatchLogs() {
419
+ const disableCloudWatchLogs = this.props.disableCloudWatchLogs ?? false;
420
+ if (!disableCloudWatchLogs)
421
+ return;
422
+ this.attachPermissions([
423
+ new PolicyStatement({
424
+ effect: Effect.DENY,
425
+ actions: [
426
+ "logs:CreateLogGroup",
427
+ "logs:CreateLogStream",
428
+ "logs:PutLogEvents",
429
+ ],
430
+ resources: ["*"],
431
+ }),
432
+ ]);
433
+ }
418
434
  isNodeRuntime() {
419
435
  const { runtime } = this.props;
420
436
  return runtime.startsWith("nodejs");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.28.0",
4
+ "version": "2.28.1",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -119,7 +119,7 @@
119
119
  "@types/ws": "^8.5.3",
120
120
  "@types/yargs": "^17.0.13",
121
121
  "archiver": "^5.3.1",
122
- "astro-sst": "2.28.0",
122
+ "astro-sst": "2.28.1",
123
123
  "tsx": "^3.12.1",
124
124
  "typescript": "^5.2.2",
125
125
  "vitest": "^0.33.0"
@@ -35794,7 +35794,7 @@ var require_DeleteParameterCommand = __commonJS({
35794
35794
  return smithy_client_1.Command;
35795
35795
  } });
35796
35796
  var Aws_json1_1_1 = require_Aws_json1_1();
35797
- var DeleteParameterCommand2 = class _DeleteParameterCommand extends smithy_client_1.Command {
35797
+ var DeleteParameterCommand = class _DeleteParameterCommand extends smithy_client_1.Command {
35798
35798
  static getEndpointParameterInstructions() {
35799
35799
  return {
35800
35800
  UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
@@ -35831,7 +35831,7 @@ var require_DeleteParameterCommand = __commonJS({
35831
35831
  return (0, Aws_json1_1_1.de_DeleteParameterCommand)(output, context);
35832
35832
  }
35833
35833
  };
35834
- exports.DeleteParameterCommand = DeleteParameterCommand2;
35834
+ exports.DeleteParameterCommand = DeleteParameterCommand;
35835
35835
  }
35836
35836
  });
35837
35837
 
@@ -35848,7 +35848,7 @@ var require_DeleteParametersCommand = __commonJS({
35848
35848
  return smithy_client_1.Command;
35849
35849
  } });
35850
35850
  var Aws_json1_1_1 = require_Aws_json1_1();
35851
- var DeleteParametersCommand = class _DeleteParametersCommand extends smithy_client_1.Command {
35851
+ var DeleteParametersCommand2 = class _DeleteParametersCommand extends smithy_client_1.Command {
35852
35852
  static getEndpointParameterInstructions() {
35853
35853
  return {
35854
35854
  UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
@@ -35885,7 +35885,7 @@ var require_DeleteParametersCommand = __commonJS({
35885
35885
  return (0, Aws_json1_1_1.de_DeleteParametersCommand)(output, context);
35886
35886
  }
35887
35887
  };
35888
- exports.DeleteParametersCommand = DeleteParametersCommand;
35888
+ exports.DeleteParametersCommand = DeleteParametersCommand2;
35889
35889
  }
35890
35890
  });
35891
35891
 
@@ -179506,18 +179506,11 @@ async function AuthKeys(cfnRequest) {
179506
179506
  }
179507
179507
  break;
179508
179508
  case "Delete":
179509
- await Promise.all([
179510
- client.send(
179511
- new import_client_ssm.DeleteParameterCommand({
179512
- Name: privatePath
179513
- })
179514
- ),
179515
- client.send(
179516
- new import_client_ssm.DeleteParameterCommand({
179517
- Name: publicPath
179518
- })
179519
- )
179520
- ]);
179509
+ await client.send(
179510
+ new import_client_ssm.DeleteParametersCommand({
179511
+ Names: [publicPath, privatePath]
179512
+ })
179513
+ );
179521
179514
  break;
179522
179515
  default:
179523
179516
  throw new Error("Unsupported request type");