sst 2.8.10 → 2.8.11
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/Job.js +10 -6
- package/constructs/SsrSite.js +1 -0
- package/package.json +1 -1
package/constructs/Job.js
CHANGED
|
@@ -183,14 +183,18 @@ export class Job extends Construct {
|
|
|
183
183
|
const app = this.node.root;
|
|
184
184
|
useDeferredTasks().add(async () => {
|
|
185
185
|
// Build function
|
|
186
|
-
const
|
|
186
|
+
const result = await useRuntimeHandlers().build(this.node.addr, "deploy");
|
|
187
187
|
// create wrapper that calls the handler
|
|
188
|
-
if (
|
|
189
|
-
throw new Error(
|
|
190
|
-
|
|
188
|
+
if (result.type === "error") {
|
|
189
|
+
throw new Error([
|
|
190
|
+
`Failed to build job "${this.props.handler}"`,
|
|
191
|
+
...result.errors,
|
|
192
|
+
].join("\n"));
|
|
193
|
+
}
|
|
194
|
+
const parsed = path.parse(result.handler);
|
|
191
195
|
const importName = parsed.ext.substring(1);
|
|
192
196
|
const importPath = `./${path.join(parsed.dir, parsed.name)}.mjs`;
|
|
193
|
-
await fs.writeFile(path.join(
|
|
197
|
+
await fs.writeFile(path.join(result.out, "handler-wrapper.mjs"), [
|
|
194
198
|
`console.log("")`,
|
|
195
199
|
`console.log("//////////////////////")`,
|
|
196
200
|
`console.log("// Start of the job //")`,
|
|
@@ -209,7 +213,7 @@ export class Job extends Construct {
|
|
|
209
213
|
`console.log("//////////////////////")`,
|
|
210
214
|
`console.log("")`,
|
|
211
215
|
].join("\n"));
|
|
212
|
-
const code = AssetCode.fromAsset(
|
|
216
|
+
const code = AssetCode.fromAsset(result.out);
|
|
213
217
|
this.updateCodeBuildProjectCode(code, "handler-wrapper.mjs");
|
|
214
218
|
// This should always be true b/c runtime is always Node.js
|
|
215
219
|
});
|
package/constructs/SsrSite.js
CHANGED