sst 2.0.32 → 2.0.34
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.
- package/constructs/App.d.ts +0 -1
- package/constructs/App.js +0 -1
- package/constructs/Function.d.ts +3 -0
- package/constructs/Function.js +17 -7
- package/constructs/RDS.js +1 -1
- package/iot.js +1 -0
- package/package.json +1 -1
- package/sst.mjs +1 -0
package/constructs/App.d.ts
CHANGED
|
@@ -173,7 +173,6 @@ export declare class App extends cdk.App {
|
|
|
173
173
|
*/
|
|
174
174
|
addDefaultFunctionLayers(layers: lambda.ILayerVersion[]): void;
|
|
175
175
|
synth(options?: cdk.StageSynthesisOptions): cxapi.CloudAssembly;
|
|
176
|
-
/** @internal */
|
|
177
176
|
finish(): Promise<void>;
|
|
178
177
|
isRunningSSTTest(): boolean;
|
|
179
178
|
getInputFilesFromEsbuildMetafile(file: string): Array<string>;
|
package/constructs/App.js
CHANGED
package/constructs/Function.d.ts
CHANGED
|
@@ -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;
|
package/constructs/Function.js
CHANGED
|
@@ -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
|
-
|
|
105
|
-
|
|
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/constructs/RDS.js
CHANGED
|
@@ -263,7 +263,7 @@ export class RDS extends Construct {
|
|
|
263
263
|
// - when running resources tests, __dirname is `resources/src`
|
|
264
264
|
// For now we will do `__dirname/../dist` to make both cases work.
|
|
265
265
|
const fn = new Fn(this, "MigrationFunction", {
|
|
266
|
-
handler: path.resolve(path.join(__dirname, "
|
|
266
|
+
handler: path.resolve(path.join(__dirname, "../support/rds-migrator/index.handler")),
|
|
267
267
|
runtime: "nodejs16.x",
|
|
268
268
|
timeout: 900,
|
|
269
269
|
memorySize: 1024,
|
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
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
|