sst 2.49.3 → 2.49.5

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.
@@ -78,7 +78,7 @@ async function error(ex) {
78
78
  "Content-Type": "application/json"
79
79
  },
80
80
  body: JSON.stringify({
81
- errorType: "Error",
81
+ errorType: ex.name ?? "Error",
82
82
  errorMessage: ex.message,
83
83
  trace: ex.stack?.split("\n")
84
84
  })
@@ -5,8 +5,17 @@ import * as fs from "fs";
5
5
  export const PROJECT_CONFIG = "cdk.json";
6
6
  export const USER_DEFAULTS = "~/.cdk.json";
7
7
  const CONTEXT_KEY = "context";
8
- const cdkToolkitUrl = await import.meta.resolve("@aws-cdk/toolkit-lib");
9
- const cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
8
+ let cdkToolkitPath;
9
+ try {
10
+ const cdkToolkitUrl = await import.meta.resolve("@aws-cdk/toolkit-lib");
11
+ cdkToolkitPath = new URL(cdkToolkitUrl).pathname;
12
+ }
13
+ catch (e) {
14
+ // Fallback for test environment where import.meta.resolve is not available
15
+ const module = await import("module");
16
+ const require = module.createRequire(import.meta.url);
17
+ cdkToolkitPath = require.resolve("@aws-cdk/toolkit-lib");
18
+ }
10
19
  const { ToolkitError } = await import(cdkToolkitPath);
11
20
  const { Context, PROJECT_CONTEXT } = await import(fs_path.resolve(cdkToolkitPath, "..", "api", "context.js"));
12
21
  const { Settings } = await import(fs_path.resolve(cdkToolkitPath, "..", "api", "settings.js"));