@mastra/deployer 1.14.0 → 1.15.0-alpha.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 1.15.0-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`681ee1c`](https://github.com/mastra-ai/mastra/commit/681ee1c811359efd1b8bebc4bce35b9bb7b14bec)]:
8
+ - @mastra/core@1.15.0-alpha.1
9
+ - @mastra/server@1.15.0-alpha.1
10
+
11
+ ## 1.15.0-alpha.0
12
+
13
+ ### Minor Changes
14
+
15
+ - Add `server.studioHost`, `server.studioProtocol`, and `server.studioPort` options for Studio in cloud deployments ([#12899](https://github.com/mastra-ai/mastra/pull/12899))
16
+
17
+ When deploying to cloud environments (e.g., Google Cloud Run), `server.host` must be `0.0.0.0` for the container to accept traffic, and the internal port often differs from the external one (e.g., 8080 internally vs 443 externally). Studio needs the actual public domain, protocol, and port to make API calls from the browser. These new options decouple the server bind configuration from the Studio API URL.
18
+
19
+ ```typescript
20
+ export const mastra = new Mastra({
21
+ server: {
22
+ host: '0.0.0.0',
23
+ port: 8080,
24
+ studioHost: 'my-app.run.app',
25
+ studioProtocol: 'https',
26
+ studioPort: 443,
27
+ },
28
+ });
29
+ ```
30
+
31
+ All three options are optional and fall back to existing behavior when not set.
32
+
33
+ ### Patch Changes
34
+
35
+ - dependencies updates: ([#14084](https://github.com/mastra-ai/mastra/pull/14084))
36
+ - Updated dependency [`@rollup/plugin-commonjs@29.0.2` ↗︎](https://www.npmjs.com/package/@rollup/plugin-commonjs/v/29.0.2) (from `29.0.0`, in `dependencies`)
37
+ - Updated dependencies [[`cb611a1`](https://github.com/mastra-ai/mastra/commit/cb611a1e89a4f4cf74c97b57e0c27bb56f2eceb5), [`62d1d3c`](https://github.com/mastra-ai/mastra/commit/62d1d3cc08fe8182e7080237fd975de862ec8c91), [`8681ecb`](https://github.com/mastra-ai/mastra/commit/8681ecb86184d5907267000e4576cc442a9a83fc), [`28d0249`](https://github.com/mastra-ai/mastra/commit/28d0249295782277040ad1e0d243e695b7ab1ce4), [`bb0f09d`](https://github.com/mastra-ai/mastra/commit/bb0f09dbac58401b36069f483acf5673202db5b5), [`5f7e9d0`](https://github.com/mastra-ai/mastra/commit/5f7e9d0db664020e1f3d97d7d18c6b0b9d4843d0), [`8ccbd39`](https://github.com/mastra-ai/mastra/commit/8ccbd39f7b1e76b0894db5ac4faa398ab885cedf)]:
38
+ - @mastra/core@1.15.0-alpha.0
39
+ - @mastra/server@1.15.0-alpha.0
40
+
3
41
  ## 1.14.0
4
42
 
5
43
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-deployer
3
3
  description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/deployer"
6
- version: "1.14.0"
6
+ version: "1.15.0-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.14.0",
2
+ "version": "1.15.0-alpha.1",
3
3
  "package": "@mastra/deployer",
4
4
  "exports": {
5
5
  "Deps": {
@@ -1049,7 +1049,7 @@ var ERR_STREAM_WRITE_AFTER_END = class extends Error {
1049
1049
  }
1050
1050
  };
1051
1051
 
1052
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/fetch-to-node/http-incoming.js
1052
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/fetch-to-node/http-incoming.js
1053
1053
  var kHeaders = /* @__PURE__ */ Symbol("kHeaders");
1054
1054
  var kHeadersDistinct = /* @__PURE__ */ Symbol("kHeadersDistinct");
1055
1055
  var kHeadersCount = /* @__PURE__ */ Symbol("kHeadersCount");
@@ -1383,7 +1383,7 @@ function onError(self, error, cb) {
1383
1383
  }
1384
1384
  }
1385
1385
 
1386
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/utils/types.js
1386
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/utils/types.js
1387
1387
  function validateString(value, name) {
1388
1388
  if (typeof value !== "string")
1389
1389
  throw new ERR_INVALID_ARG_TYPE(name, "string", value);
@@ -1420,19 +1420,19 @@ function isUint8Array(value) {
1420
1420
  return value != null && value[Symbol.toStringTag] === "Uint8Array";
1421
1421
  }
1422
1422
 
1423
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/fetch-to-node/internal-http.js
1423
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/fetch-to-node/internal-http.js
1424
1424
  var kNeedDrain = /* @__PURE__ */ Symbol("kNeedDrain");
1425
1425
  var kOutHeaders = /* @__PURE__ */ Symbol("kOutHeaders");
1426
1426
  function utcDate() {
1427
1427
  return (/* @__PURE__ */ new Date()).toUTCString();
1428
1428
  }
1429
1429
 
1430
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/fetch-to-node/internal-streams-state.js
1430
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/fetch-to-node/internal-streams-state.js
1431
1431
  function getDefaultHighWaterMark(objectMode) {
1432
1432
  return objectMode ? 16 : 64 * 1024;
1433
1433
  }
1434
1434
 
1435
- // ../../node_modules/.pnpm/fetch-to-node@2.1.0/node_modules/fetch-to-node/dist/fetch-to-node/http-common.js
1435
+ // ../../node_modules/.pnpm/fetch-to-node@2.1.0_patch_hash=42949ba7834aab28b47574e6989b8f3203c3ef91ee1ca866baf4dc8b151d34ae/node_modules/fetch-to-node/dist/fetch-to-node/http-common.js
1436
1436
  var tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
1437
1437
  function checkIsHttpToken(val) {
1438
1438
  return tokenRegExp.test(val);
@@ -2647,6 +2647,7 @@ var FetchServerResponse = class _FetchServerResponse extends FetchOutgoingMessag
2647
2647
  headers.append(header, value);
2648
2648
  }
2649
2649
  const _this = this;
2650
+ let cancelled = false;
2650
2651
  let body = this._hasBody ? new ReadableStream({
2651
2652
  start(controller) {
2652
2653
  for (const dataChunk of initialDataChunks) {
@@ -2656,17 +2657,27 @@ var FetchServerResponse = class _FetchServerResponse extends FetchOutgoingMessag
2656
2657
  controller.close();
2657
2658
  } else {
2658
2659
  _this.on("finish", () => {
2660
+ if (cancelled) return;
2659
2661
  finished = true;
2660
- controller.close();
2662
+ try {
2663
+ controller.close();
2664
+ } catch (_) {
2665
+ }
2661
2666
  });
2662
2667
  _this.on("_dataWritten", (e) => {
2663
- if (finished) {
2668
+ if (finished || cancelled) {
2664
2669
  return;
2665
2670
  }
2666
2671
  const data = _this.dataFromDataWrittenEvent(e);
2667
- controller.enqueue(data);
2672
+ try {
2673
+ controller.enqueue(data);
2674
+ } catch (_) {
2675
+ }
2668
2676
  });
2669
2677
  }
2678
+ },
2679
+ cancel() {
2680
+ cancelled = true;
2670
2681
  }
2671
2682
  }) : null;
2672
2683
  if (body != null && typeof FixedLengthStream !== "undefined") {
@@ -4179,6 +4190,9 @@ async function createHonoServer(mastra, options = {
4179
4190
  const key = serverOptions?.https?.key ?? (process.env.MASTRA_HTTPS_KEY ? Buffer.from(process.env.MASTRA_HTTPS_KEY, "base64") : void 0);
4180
4191
  const cert = serverOptions?.https?.cert ?? (process.env.MASTRA_HTTPS_CERT ? Buffer.from(process.env.MASTRA_HTTPS_CERT, "base64") : void 0);
4181
4192
  const protocol = key && cert ? "https" : "http";
4193
+ const studioHost = serverOptions?.studioHost ?? host;
4194
+ const studioProtocol = serverOptions?.studioProtocol ?? protocol;
4195
+ const studioPort = serverOptions?.studioPort ?? port;
4182
4196
  const cloudApiEndpoint = process.env.MASTRA_CLOUD_API_ENDPOINT || "";
4183
4197
  const experimentalFeatures = process.env.EXPERIMENTAL_FEATURES === "true" ? "true" : "false";
4184
4198
  const templatesEnabled = process.env.MASTRA_TEMPLATES === "true" ? "true" : "false";
@@ -4189,10 +4203,10 @@ async function createHonoServer(mastra, options = {
4189
4203
  };
4190
4204
  const autoDetectUrl = process.env.MASTRA_AUTO_DETECT_URL === "true";
4191
4205
  indexHtml = chunkQ57SABM6_cjs.injectStudioHtmlConfig(indexHtml, {
4192
- host: `'${host}'`,
4193
- port: `'${port}'`,
4194
- protocol: `'${protocol}'`,
4195
- apiPrefix: `'${apiPrefix}'`,
4206
+ host: `'${studioHost}'`,
4207
+ port: `'${studioPort}'`,
4208
+ protocol: `'${studioProtocol}'`,
4209
+ apiPrefix: `'${serverOptions?.apiPrefix ?? "/api"}'`,
4196
4210
  basePath: studioBasePath,
4197
4211
  hideCloudCta: `'${hideCloudCta}'`,
4198
4212
  cloudApiEndpoint: `'${cloudApiEndpoint}'`,
@@ -4235,6 +4249,9 @@ async function createNodeServer(mastra, options = { tools: {} }) {
4235
4249
  const host = serverOptions?.host ?? process.env.MASTRA_HOST ?? "localhost";
4236
4250
  const port = serverOptions?.port ?? (Number(process.env.PORT) || 4111);
4237
4251
  const protocol = isHttpsEnabled ? "https" : "http";
4252
+ const studioHost = serverOptions?.studioHost ?? host;
4253
+ const studioProtocol = serverOptions?.studioProtocol ?? protocol;
4254
+ const studioPort = serverOptions?.studioPort ?? port;
4238
4255
  const server = serve(
4239
4256
  {
4240
4257
  fetch: app.fetch,
@@ -4253,7 +4270,7 @@ async function createNodeServer(mastra, options = { tools: {} }) {
4253
4270
  logger2.info(` Mastra API running on ${protocol}://${host}:${port}${apiPrefix}`);
4254
4271
  if (options?.studio) {
4255
4272
  const studioBasePath = chunkQ57SABM6_cjs.normalizeStudioBase(serverOptions?.studioBase ?? "/");
4256
- const studioUrl = `${protocol}://${host}:${port}${studioBasePath}`;
4273
+ const studioUrl = `${studioProtocol}://${studioHost}:${studioPort}${studioBasePath}`;
4257
4274
  logger2.info(`\u{1F468}\u200D\u{1F4BB} Studio available at ${studioUrl}`);
4258
4275
  }
4259
4276
  if (process.send) {