sst 2.5.3 → 2.5.4

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.
@@ -68,7 +68,9 @@ export class ApiGatewayV1Api extends Construct {
68
68
  * The AWS generated URL of the Api.
69
69
  */
70
70
  get url() {
71
- return this.cdk.restApi.url;
71
+ const app = this.node.root;
72
+ return (this.cdk.restApi.url ??
73
+ `https://${this.cdk.restApi.restApiId}.execute-api.${app.region}.amazonaws.com/${app.stage}/`);
72
74
  }
73
75
  /**
74
76
  * If custom domain is enabled, this is the custom domain URL of the Api.
@@ -226,7 +226,7 @@ export interface StaticSiteProps {
226
226
  */
227
227
  id?: string;
228
228
  /**
229
- * Allows you to override default settings this construct uses internally to ceate the bucket
229
+ * Allows you to override default settings this construct uses internally to create the bucket
230
230
  *
231
231
  * @example
232
232
  * ```js
@@ -23,6 +23,10 @@ interface GraphQLHandlerConfig<C> {
23
23
  * Override the GraphQL execute function, sometimes used by plugins
24
24
  */
25
25
  execute?: ProcessRequestOptions<any, any>["execute"];
26
+ /**
27
+ * Disable introspection for production
28
+ */
29
+ disableIntrospection?: boolean;
26
30
  }
27
31
  export declare function GraphQLHandler<C>(config: GraphQLHandlerConfig<C>): (event: APIGatewayProxyEventV2, context: Context) => Promise<{
28
32
  statusCode: any;
@@ -1,3 +1,4 @@
1
+ import { specifiedRules, NoSchemaIntrospectionCustomRule, } from "graphql";
1
2
  import { getGraphQLParameters, processRequest,
2
3
  // @ts-expect-error
3
4
  } from "graphql-helix";
@@ -12,11 +13,15 @@ export function GraphQLHandler(config) {
12
13
  headers: useHeaders(),
13
14
  };
14
15
  const { operationName, query, variables } = getGraphQLParameters(request);
16
+ const validationRules = config.disableIntrospection
17
+ ? [...specifiedRules, NoSchemaIntrospectionCustomRule]
18
+ : [...specifiedRules];
15
19
  const result = await processRequest({
16
20
  operationName,
17
21
  query,
18
22
  variables,
19
23
  request,
24
+ validationRules,
20
25
  execute: config.execute,
21
26
  schema: config.schema,
22
27
  formatPayload: config.formatPayload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.5.3",
3
+ "version": "2.5.4",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
@@ -67,7 +67,10 @@ export const useGoHandler = Context.memo(async () => {
67
67
  });
68
68
  }
69
69
  catch (ex) {
70
- throw new VisibleError(`Failed to build ${ex}`);
70
+ return {
71
+ type: "error",
72
+ errors: [String(ex)],
73
+ };
71
74
  }
72
75
  }
73
76
  if (input.mode === "deploy") {
@@ -85,7 +88,10 @@ export const useGoHandler = Context.memo(async () => {
85
88
  });
86
89
  }
87
90
  catch (ex) {
88
- throw new VisibleError(`Failed to build ${ex}`);
91
+ return {
92
+ type: "error",
93
+ errors: [String(ex)],
94
+ };
89
95
  }
90
96
  }
91
97
  return {
@@ -125,8 +125,8 @@ export const useNodeHandler = Context.memo(async () => {
125
125
  js: [
126
126
  `import { createRequire as topLevelCreateRequire } from 'module';`,
127
127
  `const require = topLevelCreateRequire(import.meta.url);`,
128
- `import { fileURLToPath as topLevelFileUrlToPath } from "url"`,
129
- `const __dirname = topLevelFileUrlToPath(new URL(".", import.meta.url))`,
128
+ `import { fileURLToPath as topLevelFileUrlToPath, URL as topLevelURL } from "url"`,
129
+ `const __dirname = topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))`,
130
130
  nodejs.banner || "",
131
131
  ].join("\n"),
132
132
  },
@@ -56,9 +56,14 @@ export const useRuntimeHandlers = Context.memo(() => {
56
56
  recursive: true,
57
57
  });
58
58
  if (mode === "start") {
59
- const dir = path.dirname(toPath);
60
- await fs.mkdir(dir, { recursive: true });
61
- await fs.symlink(fromPath, toPath);
59
+ try {
60
+ const dir = path.dirname(toPath);
61
+ await fs.mkdir(dir, { recursive: true });
62
+ await fs.symlink(fromPath, toPath);
63
+ }
64
+ catch (ex) {
65
+ Logger.debug("Failed to symlink", fromPath, toPath, ex);
66
+ }
62
67
  }
63
68
  }));
64
69
  }
package/sst.mjs CHANGED
@@ -3583,9 +3583,13 @@ var init_handlers = __esm({
3583
3583
  recursive: true
3584
3584
  });
3585
3585
  if (mode === "start") {
3586
- const dir = path7.dirname(toPath);
3587
- await fs7.mkdir(dir, { recursive: true });
3588
- await fs7.symlink(fromPath, toPath);
3586
+ try {
3587
+ const dir = path7.dirname(toPath);
3588
+ await fs7.mkdir(dir, { recursive: true });
3589
+ await fs7.symlink(fromPath, toPath);
3590
+ } catch (ex) {
3591
+ Logger.debug("Failed to symlink", fromPath, toPath, ex);
3592
+ }
3589
3593
  }
3590
3594
  })
3591
3595
  );
@@ -4221,8 +4225,8 @@ var init_node = __esm({
4221
4225
  js: [
4222
4226
  `import { createRequire as topLevelCreateRequire } from 'module';`,
4223
4227
  `const require = topLevelCreateRequire(import.meta.url);`,
4224
- `import { fileURLToPath as topLevelFileUrlToPath } from "url"`,
4225
- `const __dirname = topLevelFileUrlToPath(new URL(".", import.meta.url))`,
4228
+ `import { fileURLToPath as topLevelFileUrlToPath, URL as topLevelURL } from "url"`,
4229
+ `const __dirname = topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))`,
4226
4230
  nodejs.banner || ""
4227
4231
  ].join("\n")
4228
4232
  }
@@ -4419,7 +4423,10 @@ var init_go = __esm({
4419
4423
  }
4420
4424
  );
4421
4425
  } catch (ex) {
4422
- throw new VisibleError(`Failed to build ${ex}`);
4426
+ return {
4427
+ type: "error",
4428
+ errors: [String(ex)]
4429
+ };
4423
4430
  }
4424
4431
  }
4425
4432
  if (input.mode === "deploy") {
@@ -4439,7 +4446,10 @@ var init_go = __esm({
4439
4446
  }
4440
4447
  );
4441
4448
  } catch (ex) {
4442
- throw new VisibleError(`Failed to build ${ex}`);
4449
+ return {
4450
+ type: "error",
4451
+ errors: [String(ex)]
4452
+ };
4443
4453
  }
4444
4454
  }
4445
4455
  return {