@cdklabs/deploy-time-build 0.0.1 → 0.0.2

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.
Files changed (45) hide show
  1. package/.jsii +9563 -0
  2. package/.jsii.tabl.json +1 -0
  3. package/API.md +1673 -0
  4. package/AmazonQ.md +65 -0
  5. package/LICENSE +202 -0
  6. package/README.md +212 -45
  7. package/example/README.md +18 -0
  8. package/example/cdk.json +3 -0
  9. package/example/example-app/index.html +12 -0
  10. package/example/example-app/package-lock.json +1804 -0
  11. package/example/example-app/package.json +21 -0
  12. package/example/example-app/src/App.css +42 -0
  13. package/example/example-app/src/App.tsx +43 -0
  14. package/example/example-app/src/index.css +13 -0
  15. package/example/example-app/src/main.tsx +10 -0
  16. package/example/example-app/src/vite.env.d.ts +1 -0
  17. package/example/example-app/tsconfig.json +21 -0
  18. package/example/example-app/tsconfig.node.json +8 -0
  19. package/example/example-app/vite.config.ts +7 -0
  20. package/example/example-image/Dockerfile +6 -0
  21. package/example/index.ts +156 -0
  22. package/imgs/architecture.png +0 -0
  23. package/imgs/demo.png +0 -0
  24. package/imgs/soci-architecture.png +0 -0
  25. package/lambda/trigger-codebuild/dist/index.js +279 -0
  26. package/lambda/trigger-codebuild/index.ts +269 -0
  27. package/lambda/trigger-codebuild/package-lock.json +2904 -0
  28. package/lambda/trigger-codebuild/package.json +17 -0
  29. package/lib/container-image-build.d.ts +84 -0
  30. package/lib/container-image-build.js +221 -0
  31. package/lib/index.d.ts +4 -0
  32. package/lib/index.js +21 -0
  33. package/lib/nodejs-build.d.ts +84 -0
  34. package/lib/nodejs-build.js +221 -0
  35. package/lib/singleton-project.d.ts +28 -0
  36. package/lib/singleton-project.js +43 -0
  37. package/lib/soci-index-build.d.ts +30 -0
  38. package/lib/soci-index-build.js +118 -0
  39. package/lib/soci-index-v2-build.d.ts +41 -0
  40. package/lib/soci-index-v2-build.js +131 -0
  41. package/lib/types.d.ts +44 -0
  42. package/lib/types.js +3 -0
  43. package/package.json +156 -6
  44. package/rosetta/default.ts-fixture +24 -0
  45. package/rosetta/imported.ts-fixture +25 -0
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "example-app",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "tsc && vite build",
8
+ "preview": "vite preview"
9
+ },
10
+ "dependencies": {
11
+ "react": "^18.0.0",
12
+ "react-dom": "^18.0.0"
13
+ },
14
+ "devDependencies": {
15
+ "@types/react": "^18.0.0",
16
+ "@types/react-dom": "^18.0.0",
17
+ "@vitejs/plugin-react": "^5",
18
+ "typescript": "^5",
19
+ "vite": "^7"
20
+ }
21
+ }
@@ -0,0 +1,42 @@
1
+ .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-logo {
6
+ height: 40vmin;
7
+ pointer-events: none;
8
+ }
9
+
10
+ @media (prefers-reduced-motion: no-preference) {
11
+ .App-logo {
12
+ animation: App-logo-spin infinite 20s linear;
13
+ }
14
+ }
15
+
16
+ .App-header {
17
+ background-color: #282c34;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: calc(10px + 2vmin);
24
+ color: white;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ @keyframes App-logo-spin {
32
+ from {
33
+ transform: rotate(0deg);
34
+ }
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ }
39
+
40
+ button {
41
+ font-size: calc(10px + 2vmin);
42
+ }
@@ -0,0 +1,43 @@
1
+ import { useState } from 'react'
2
+ import './App.css'
3
+
4
+ function App() {
5
+ const [count, setCount] = useState(0)
6
+
7
+ return (
8
+ <div className="App">
9
+ <header className="App-header">
10
+ <p>Hello Vite + React!</p>
11
+ <p>
12
+ <button type="button" onClick={() => setCount((count) => count + 1)}>
13
+ count is: {count}
14
+ </button>
15
+ </p>
16
+ <p>
17
+ Your API endpoint: <code>{import.meta.env.VITE_API_ENDPOINT ?? 'undefined'}</code>
18
+ </p>
19
+ <p>
20
+ <a
21
+ className="App-link"
22
+ href="https://reactjs.org"
23
+ target="_blank"
24
+ rel="noopener noreferrer"
25
+ >
26
+ Learn React
27
+ </a>
28
+ {' | '}
29
+ <a
30
+ className="App-link"
31
+ href="https://vitejs.dev/guide/features.html"
32
+ target="_blank"
33
+ rel="noopener noreferrer"
34
+ >
35
+ Vite Docs
36
+ </a>
37
+ </p>
38
+ </header>
39
+ </div>
40
+ )
41
+ }
42
+
43
+ export default App
@@ -0,0 +1,13 @@
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+ import App from './App'
4
+ import './index.css'
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')!).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>
10
+ )
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
6
+ "allowJs": false,
7
+ "skipLibCheck": true,
8
+ "esModuleInterop": false,
9
+ "allowSyntheticDefaultImports": true,
10
+ "strict": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "module": "ESNext",
13
+ "moduleResolution": "Node",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "noEmit": true,
17
+ "jsx": "react-jsx"
18
+ },
19
+ "include": ["src"],
20
+ "references": [{ "path": "./tsconfig.node.json" }]
21
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "module": "esnext",
5
+ "moduleResolution": "node"
6
+ },
7
+ "include": ["vite.config.ts"]
8
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+
4
+ // https://vitejs.dev/config/
5
+ export default defineConfig({
6
+ plugins: [react()]
7
+ })
@@ -0,0 +1,6 @@
1
+ FROM public.ecr.aws/nginx/nginx:1.26
2
+ # create dummy file to change the size of a image
3
+ ARG DUMMY_FILE_SIZE_MB="10"
4
+ ARG HASH=""
5
+ # RUN fallocate -l ${DUMMY_FILE_SIZE_MB} dummy.img
6
+ RUN dd if=/dev/zero of=dummy.img bs=1M count=${DUMMY_FILE_SIZE_MB}
@@ -0,0 +1,156 @@
1
+ import { App, CfnOutput, Stack, StackProps } from 'aws-cdk-lib';
2
+ import { MockIntegration, RestApi } from 'aws-cdk-lib/aws-apigateway';
3
+ import { AllowedMethods, Distribution, OriginRequestPolicy, SecurityPolicyProtocol, SSLMethod, ViewerProtocolPolicy } from 'aws-cdk-lib/aws-cloudfront';
4
+ import { S3BucketOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
5
+ import { SubnetType, Vpc } from 'aws-cdk-lib/aws-ec2';
6
+ import { DockerImageAsset, Platform } from 'aws-cdk-lib/aws-ecr-assets';
7
+ import { AwsLogDriver, Cluster, ContainerImage, CpuArchitecture, FargateTaskDefinition } from 'aws-cdk-lib/aws-ecs';
8
+ import { DockerImageFunction } from 'aws-cdk-lib/aws-lambda';
9
+ import { BlockPublicAccess, Bucket, BucketEncryption } from 'aws-cdk-lib/aws-s3';
10
+ import { Construct } from 'constructs';
11
+ import { ContainerImageBuild, NodejsBuild, SociIndexBuild, SociIndexV2Build } from '../src/';
12
+
13
+ class NodejsTestStack extends Stack {
14
+ constructor(scope: Construct, id: string, props: StackProps = {}) {
15
+ super(scope, id, props);
16
+
17
+ const api = new RestApi(this, 'ExampleApi');
18
+ api.root.addMethod(
19
+ 'ANY',
20
+ new MockIntegration({
21
+ integrationResponses: [{ statusCode: '200' }],
22
+ requestTemplates: {
23
+ 'application/json': '{ "statusCode": 200 }',
24
+ },
25
+ }),
26
+ {
27
+ methodResponses: [{ statusCode: '200' }],
28
+ }
29
+ );
30
+
31
+ const dstBucket = new Bucket(this, 'DstBucket', {
32
+ // autoDeleteObjects: true,
33
+ // removalPolicy: RemovalPolicy.DESTROY,
34
+ blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
35
+ encryption: BucketEncryption.S3_MANAGED,
36
+ });
37
+ const dstPath = '/';
38
+
39
+ const distribution = new Distribution(this, "distribution", {
40
+ defaultRootObject: "index.html",
41
+ defaultBehavior: {
42
+ origin: S3BucketOrigin.withOriginAccessControl(dstBucket),
43
+ viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
44
+ allowedMethods: AllowedMethods.ALLOW_ALL,
45
+ originRequestPolicy: OriginRequestPolicy.CORS_S3_ORIGIN,
46
+ },
47
+ minimumProtocolVersion: SecurityPolicyProtocol.TLS_V1_2_2021,
48
+ sslSupportMethod: SSLMethod.SNI,
49
+ });
50
+
51
+ new CfnOutput(this, 'DistributionUrl', {
52
+ value: `https://${distribution.distributionDomainName}`,
53
+ });
54
+
55
+ new NodejsBuild(this, 'ExampleBuild', {
56
+ assets: [
57
+ {
58
+ path: 'example-app',
59
+ exclude: ['dist', 'node_modules'],
60
+ },
61
+ ],
62
+ destinationBucket: dstBucket,
63
+ destinationKeyPrefix: dstPath,
64
+ outputSourceDirectory: 'dist',
65
+ distribution,
66
+ buildCommands: ['npm ci', 'npm run build'],
67
+ buildEnvironment: {
68
+ VITE_API_ENDPOINT: api.url,
69
+ AAA: 'asdf',
70
+ BBB: dstBucket.bucketName,
71
+ },
72
+ nodejsVersion: 20,
73
+ outputEnvFile: true,
74
+ });
75
+ }
76
+ }
77
+
78
+ class SociIndexTestStack extends Stack {
79
+ constructor(scope: Construct, id: string, props: StackProps = {}) {
80
+ super(scope, id, props);
81
+
82
+ const asset = new DockerImageAsset(this, 'Image', { directory: 'example-image', platform: Platform.LINUX_AMD64 });
83
+
84
+ new SociIndexBuild(this, 'Index', { imageTag: asset.assetHash, repository: asset.repository });
85
+
86
+ new Cluster(this, 'Cluster', {
87
+ vpc: new Vpc(this, 'Vpc', {
88
+ maxAzs: 1,
89
+ subnetConfiguration: [
90
+ {
91
+ cidrMask: 24,
92
+ name: 'public',
93
+ subnetType: SubnetType.PUBLIC,
94
+ },
95
+ ],
96
+ }),
97
+ });
98
+ new FargateTaskDefinition(this, 'TaskDefinition', {}).addContainer('main', {
99
+ image: ContainerImage.fromEcrRepository(asset.repository, asset.assetHash),
100
+
101
+ logging: new AwsLogDriver({ streamPrefix: 'main' }),
102
+ });
103
+
104
+ const v2 = SociIndexV2Build.fromDockerImageAsset(this, 'IndexV2', asset);
105
+
106
+ new FargateTaskDefinition(this, 'TaskDefinitionV2', {}).addContainer('main', {
107
+ image: v2.toEcsDockerImageCode(),
108
+ logging: new AwsLogDriver({ streamPrefix: 'main' }),
109
+ });
110
+ }
111
+ }
112
+
113
+ class ContainerImageTestStack extends Stack {
114
+ constructor(scope: Construct, id: string, props: StackProps = {}) {
115
+ super(scope, id, props);
116
+
117
+ const image = new ContainerImageBuild(this, 'Build', { directory: 'example-image', buildArgs: { DUMMY_FILE_SIZE_MB: '15' } });
118
+ const armImage = new ContainerImageBuild(this, 'BuildArm', {
119
+ directory: 'example-image',
120
+ platform: Platform.LINUX_ARM64,
121
+ repository: image.repository,
122
+ zstdCompression: true,
123
+ });
124
+ new DockerImageFunction(this, 'Function', {
125
+ code: image.toLambdaDockerImageCode(),
126
+ });
127
+ new Cluster(this, 'Cluster', {
128
+ vpc: new Vpc(this, 'Vpc', {
129
+ maxAzs: 1,
130
+ subnetConfiguration: [
131
+ {
132
+ cidrMask: 24,
133
+ name: 'public',
134
+ subnetType: SubnetType.PUBLIC,
135
+ },
136
+ ],
137
+ }),
138
+ });
139
+ new FargateTaskDefinition(this, 'TaskDefinition', { runtimePlatform: { cpuArchitecture: CpuArchitecture.ARM64 } }).addContainer('main', {
140
+ image: armImage.toEcsDockerImageCode(),
141
+ logging: new AwsLogDriver({ streamPrefix: 'main' }),
142
+ });
143
+ }
144
+ }
145
+
146
+ class TestApp extends App {
147
+ constructor() {
148
+ super();
149
+
150
+ new NodejsTestStack(this, 'NodejsTestStack');
151
+ new SociIndexTestStack(this, 'SociIndexTestStack');
152
+ new ContainerImageTestStack(this, 'ContainerImageTestStack');
153
+ }
154
+ }
155
+
156
+ new TestApp().synth();
Binary file
package/imgs/demo.png ADDED
Binary file
Binary file
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ handler: () => handler
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_client_codebuild = require("@aws-sdk/client-codebuild");
37
+ var import_crypto = __toESM(require("crypto"));
38
+ var import_promises = require("timers/promises");
39
+ var cb = new import_client_codebuild.CodeBuildClient({});
40
+ var handler = async (event, context) => {
41
+ try {
42
+ if (event.RequestType == "Create" || event.RequestType == "Update") {
43
+ const props = event.ResourceProperties;
44
+ const commonEnvironments = [
45
+ {
46
+ name: "responseURL",
47
+ value: event.ResponseURL
48
+ },
49
+ {
50
+ name: "stackId",
51
+ value: event.StackId
52
+ },
53
+ {
54
+ name: "requestId",
55
+ value: event.RequestId
56
+ },
57
+ {
58
+ name: "logicalResourceId",
59
+ value: event.LogicalResourceId
60
+ }
61
+ ];
62
+ const newPhysicalId = import_crypto.default.randomBytes(16).toString("hex");
63
+ let command;
64
+ switch (props.type) {
65
+ case "NodejsBuild":
66
+ command = new import_client_codebuild.StartBuildCommand({
67
+ projectName: props.codeBuildProjectName,
68
+ environmentVariablesOverride: [
69
+ ...commonEnvironments,
70
+ {
71
+ name: "input",
72
+ value: JSON.stringify(
73
+ props.sources.map((source) => ({
74
+ assetUrl: `s3://${source.sourceBucketName}/${source.sourceObjectKey}`,
75
+ extractPath: source.extractPath,
76
+ commands: (source.commands ?? []).join(" && ")
77
+ }))
78
+ )
79
+ },
80
+ {
81
+ name: "buildCommands",
82
+ value: props.buildCommands.join(" && ")
83
+ },
84
+ {
85
+ name: "destinationBucketName",
86
+ value: props.destinationBucketName
87
+ },
88
+ {
89
+ name: "destinationKeyPrefix",
90
+ // remove the beginning / if any
91
+ value: props.destinationKeyPrefix.startsWith("/") ? props.destinationKeyPrefix.slice(1) : props.destinationKeyPrefix
92
+ },
93
+ {
94
+ name: "distributionId",
95
+ value: props.distributionId ?? ""
96
+ },
97
+ {
98
+ name: "distributionPath",
99
+ value: (() => {
100
+ let path = props.destinationKeyPrefix;
101
+ if (!path.startsWith("/")) {
102
+ path = "/" + path;
103
+ }
104
+ if (!path.endsWith("/")) {
105
+ path += "/";
106
+ }
107
+ return path + "*";
108
+ })()
109
+ },
110
+ {
111
+ name: "assetBucketName",
112
+ value: props.assetBucketName
113
+ },
114
+ {
115
+ name: "workingDirectory",
116
+ value: props.workingDirectory
117
+ },
118
+ {
119
+ name: "outputSourceDirectory",
120
+ value: props.outputSourceDirectory
121
+ },
122
+ {
123
+ name: "projectName",
124
+ value: props.codeBuildProjectName
125
+ },
126
+ {
127
+ name: "outputEnvFile",
128
+ value: props.outputEnvFile.toString()
129
+ },
130
+ {
131
+ name: "envFileKey",
132
+ value: `deploy-time-build/${event.StackId.split("/")[1]}/${event.LogicalResourceId}/${newPhysicalId}.env`
133
+ },
134
+ {
135
+ name: "envNames",
136
+ value: Object.keys(props.environment ?? {}).join(",")
137
+ },
138
+ ...Object.entries(props.environment ?? {}).map(([name, value]) => ({
139
+ name,
140
+ value
141
+ }))
142
+ ]
143
+ });
144
+ break;
145
+ case "SociIndexBuild":
146
+ command = new import_client_codebuild.StartBuildCommand({
147
+ projectName: props.codeBuildProjectName,
148
+ environmentVariablesOverride: [
149
+ ...commonEnvironments,
150
+ {
151
+ name: "repositoryName",
152
+ value: props.repositoryName
153
+ },
154
+ {
155
+ name: "imageTag",
156
+ value: props.imageTag
157
+ },
158
+ {
159
+ name: "projectName",
160
+ value: props.codeBuildProjectName
161
+ }
162
+ ]
163
+ });
164
+ break;
165
+ case "SociIndexV2Build":
166
+ command = new import_client_codebuild.StartBuildCommand({
167
+ projectName: props.codeBuildProjectName,
168
+ environmentVariablesOverride: [
169
+ ...commonEnvironments,
170
+ {
171
+ name: "repositoryName",
172
+ value: props.repositoryName
173
+ },
174
+ {
175
+ name: "inputImageTag",
176
+ value: props.inputImageTag
177
+ },
178
+ {
179
+ name: "outputImageTag",
180
+ value: props.outputImageTag
181
+ },
182
+ {
183
+ name: "projectName",
184
+ value: props.codeBuildProjectName
185
+ }
186
+ ]
187
+ });
188
+ break;
189
+ case "ContainerImageBuild": {
190
+ const imageTag = props.imageTag ?? `${props.tagPrefix ?? ""}${newPhysicalId}`;
191
+ command = new import_client_codebuild.StartBuildCommand({
192
+ projectName: props.codeBuildProjectName,
193
+ environmentVariablesOverride: [
194
+ ...commonEnvironments,
195
+ {
196
+ name: "repositoryUri",
197
+ value: props.repositoryUri
198
+ },
199
+ {
200
+ name: "repositoryAuthUri",
201
+ value: props.repositoryUri.split("/")[0]
202
+ },
203
+ {
204
+ name: "repositoryRegion",
205
+ value: props.repositoryUri.split(".")[3]
206
+ },
207
+ {
208
+ name: "buildCommand",
209
+ value: props.buildCommand
210
+ },
211
+ {
212
+ name: "imageTag",
213
+ value: imageTag
214
+ },
215
+ {
216
+ name: "projectName",
217
+ value: props.codeBuildProjectName
218
+ },
219
+ {
220
+ name: "sourceS3Url",
221
+ value: props.sourceS3Url
222
+ }
223
+ ]
224
+ });
225
+ break;
226
+ }
227
+ default:
228
+ throw new Error(`invalid event type ${props}}`);
229
+ }
230
+ let retries = 0;
231
+ while (retries < 10) {
232
+ try {
233
+ await cb.send(command);
234
+ break;
235
+ } catch (error) {
236
+ if (error.name === "AccessDeniedException") {
237
+ retries++;
238
+ console.log(`AccessDeniedException encountered, retrying (${retries})...`);
239
+ await (0, import_promises.setTimeout)(5e3);
240
+ } else {
241
+ throw error;
242
+ }
243
+ }
244
+ }
245
+ } else {
246
+ await sendStatus("SUCCESS", event, context);
247
+ }
248
+ } catch (e) {
249
+ console.log(e);
250
+ const err = e;
251
+ await sendStatus("FAILED", event, context, err.message);
252
+ }
253
+ };
254
+ var sendStatus = async (status, event, context, reason) => {
255
+ const responseBody = {
256
+ Status: status,
257
+ Reason: reason ?? "See the details in CloudWatch Log Stream: " + context.logStreamName,
258
+ PhysicalResourceId: context.logStreamName,
259
+ StackId: event.StackId,
260
+ RequestId: event.RequestId,
261
+ LogicalResourceId: event.LogicalResourceId,
262
+ NoEcho: false,
263
+ Data: {}
264
+ //responseData
265
+ };
266
+ const responseBodyString = JSON.stringify(responseBody);
267
+ await fetch(event.ResponseURL, {
268
+ method: "PUT",
269
+ body: responseBodyString,
270
+ headers: {
271
+ "Content-Type": "",
272
+ "Content-Length": responseBodyString.length.toString()
273
+ }
274
+ });
275
+ };
276
+ // Annotate the CommonJS export names for ESM import in node:
277
+ 0 && (module.exports = {
278
+ handler
279
+ });