sst 2.0.32 → 2.0.33

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.
@@ -598,6 +598,9 @@ export declare class Function extends lambda.Function implements SSTConstruct {
598
598
  };
599
599
  };
600
600
  private createUrl;
601
+ private isNodeRuntime;
602
+ static validateHandlerSet(id: string, props: FunctionProps): void;
603
+ static validateVpcSettings(id: string, props: FunctionProps): void;
601
604
  static buildLayers(scope: Construct, id: string, props: FunctionProps): cdk.aws_lambda.ILayerVersion[];
602
605
  static normalizeMemorySize(memorySize?: number | Size): number;
603
606
  static normalizeDiskSize(diskSize?: number | Size): cdk.Size;
@@ -101,12 +101,8 @@ export class Function extends lambda.Function {
101
101
  const logRetention = props.logRetention &&
102
102
  logs.RetentionDays[props.logRetention.toUpperCase()];
103
103
  const isLiveDevEnabled = props.enableLiveDev === false ? false : true;
104
- // Validate handler
105
- if (!handler) {
106
- throw new Error(`No handler defined for the "${id}" Lambda function`);
107
- }
108
- // Validate input
109
- const isNodeRuntime = props.runtime.startsWith("nodejs");
104
+ Function.validateHandlerSet(id, props);
105
+ Function.validateVpcSettings(id, props);
110
106
  // Handle local development (ie. sst start)
111
107
  // - set runtime to nodejs12.x for non-Node runtimes (b/c the stub is in Node)
112
108
  // - set retry to 0. When the debugger is disconnected, the Cron construct
@@ -223,7 +219,7 @@ export class Function extends lambda.Function {
223
219
  }
224
220
  this.id = id;
225
221
  this.props = props || {};
226
- if (isNodeRuntime) {
222
+ if (this.isNodeRuntime()) {
227
223
  // Enable reusing connections with Keep-Alive for NodeJs
228
224
  // Lambda function
229
225
  this.addEnvironment("AWS_NODEJS_CONNECTION_REUSE_ENABLED", "1", {
@@ -345,6 +341,20 @@ export class Function extends lambda.Function {
345
341
  cors: functionUrlCors.buildCorsConfig(cors),
346
342
  });
347
343
  }
344
+ isNodeRuntime() {
345
+ const { runtime } = this.props;
346
+ return runtime.startsWith("nodejs");
347
+ }
348
+ static validateHandlerSet(id, props) {
349
+ if (!props.handler) {
350
+ throw new Error(`No handler defined for the "${id}" Lambda function`);
351
+ }
352
+ }
353
+ static validateVpcSettings(id, props) {
354
+ if (props.securityGroups && !props.vpc) {
355
+ throw new Error(`Cannot configure "securityGroups" without "vpc" for the "${id}" Lambda function.`);
356
+ }
357
+ }
348
358
  static buildLayers(scope, id, props) {
349
359
  return (props.layers || []).map((layer) => {
350
360
  if (typeof layer === "string") {
package/iot.js CHANGED
@@ -25,6 +25,7 @@ export const useIOT = Context.memo(async () => {
25
25
  const device = new iot.device({
26
26
  protocol: "wss",
27
27
  host: endpoint,
28
+ region: project.config.region,
28
29
  accessKeyId: creds.accessKeyId,
29
30
  secretKey: creds.secretAccessKey,
30
31
  sessionToken: creds.sessionToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.0.32",
3
+ "version": "2.0.33",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
package/sst.mjs CHANGED
@@ -2546,6 +2546,7 @@ var init_iot = __esm({
2546
2546
  const device = new iot.device({
2547
2547
  protocol: "wss",
2548
2548
  host: endpoint,
2549
+ region: project.config.region,
2549
2550
  accessKeyId: creds.accessKeyId,
2550
2551
  secretKey: creds.secretAccessKey,
2551
2552
  sessionToken: creds.sessionToken