vercel 50.3.2 → 50.3.3

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 (2) hide show
  1. package/dist/index.js +111 -20
  2. package/package.json +18 -18
package/dist/index.js CHANGED
@@ -50311,7 +50311,7 @@ var require_package = __commonJS2({
50311
50311
  "../client/package.json"(exports2, module2) {
50312
50312
  module2.exports = {
50313
50313
  name: "@vercel/client",
50314
- version: "17.2.21",
50314
+ version: "17.2.22",
50315
50315
  main: "dist/index.js",
50316
50316
  typings: "dist/index.d.ts",
50317
50317
  homepage: "https://vercel.com",
@@ -58741,7 +58741,7 @@ var require_utils14 = __commonJS2({
58741
58741
  var import_url20 = __require("url");
58742
58742
  var import_ignore = __toESM4(require_ignore());
58743
58743
  var import_pkg6 = require_pkg();
58744
- var import_build_utils19 = __require("@vercel/build-utils");
58744
+ var import_build_utils20 = __require("@vercel/build-utils");
58745
58745
  var import_async_sema = require_lib9();
58746
58746
  var import_fs_extra25 = require_lib8();
58747
58747
  var import_readdir_recursive = __toESM4(require_readdir_recursive());
@@ -58934,7 +58934,7 @@ var require_utils14 = __commonJS2({
58934
58934
  maybeRead((0, import_path43.join)(cwd2, ".nowignore"), "")
58935
58935
  ]);
58936
58936
  if (vercelignore && nowignore) {
58937
- throw new import_build_utils19.NowBuildError({
58937
+ throw new import_build_utils20.NowBuildError({
58938
58938
  code: "CONFLICTING_IGNORE_FILES",
58939
58939
  message: "Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file.",
58940
58940
  link: "https://vercel.link/combining-old-and-new-config"
@@ -64123,7 +64123,7 @@ var require_create_deployment = __commonJS2({
64123
64123
  var import_utils6 = require_utils14();
64124
64124
  var import_errors4 = require_errors2();
64125
64125
  var import_error_utils38 = require_dist2();
64126
- var import_build_utils19 = __require("@vercel/build-utils");
64126
+ var import_build_utils20 = __require("@vercel/build-utils");
64127
64127
  var import_tar_fs2 = __toESM4(require_tar_fs());
64128
64128
  var import_zlib = __require("zlib");
64129
64129
  function buildCreateDeployment() {
@@ -64188,7 +64188,7 @@ var require_create_deployment = __commonJS2({
64188
64188
  const tarStream = import_tar_fs2.default.pack(workPath, {
64189
64189
  entries: fileList.map((file) => (0, import_path43.relative)(workPath, file))
64190
64190
  }).pipe((0, import_zlib.createGzip)());
64191
- const chunkedTarBuffers = await (0, import_build_utils19.streamToBufferChunks)(tarStream);
64191
+ const chunkedTarBuffers = await (0, import_build_utils20.streamToBufferChunks)(tarStream);
64192
64192
  debug2(`Packed tarball into ${chunkedTarBuffers.length} chunks`);
64193
64193
  files = new Map(
64194
64194
  chunkedTarBuffers.map((chunk, index) => [
@@ -83391,7 +83391,7 @@ var require_detect_builders = __commonJS2({
83391
83391
  var import_path43 = __require("path");
83392
83392
  var import_frameworks8 = __toESM4(require_frameworks());
83393
83393
  var import_is_official_runtime = require_is_official_runtime();
83394
- var import_build_utils19 = __require("@vercel/build-utils");
83394
+ var import_build_utils20 = __require("@vercel/build-utils");
83395
83395
  var REGEX_MIDDLEWARE_FILES = "middleware.[jt]s";
83396
83396
  var REGEX_VERCEL_PLATFORM_FILES = `api/**,package.json,${REGEX_MIDDLEWARE_FILES}`;
83397
83397
  var REGEX_NON_VERCEL_PLATFORM_FILES2 = `!{${REGEX_VERCEL_PLATFORM_FILES}}`;
@@ -83645,7 +83645,7 @@ var require_detect_builders = __commonJS2({
83645
83645
  }
83646
83646
  if (fileName.endsWith(".py") && options.workPath) {
83647
83647
  const fsPath = (0, import_path43.join)(options.workPath, fileName);
83648
- const isEntrypoint = await (0, import_build_utils19.isPythonEntrypoint)({ fsPath });
83648
+ const isEntrypoint = await (0, import_build_utils20.isPythonEntrypoint)({ fsPath });
83649
83649
  if (!isEntrypoint) {
83650
83650
  return null;
83651
83651
  }
@@ -149143,6 +149143,60 @@ var init_validate_config = __esm({
149143
149143
  }
149144
149144
  });
149145
149145
 
149146
+ // src/util/validate-cron-secret.ts
149147
+ import { NowBuildError as NowBuildError5 } from "@vercel/build-utils";
149148
+ function validateCronSecret(cronSecret) {
149149
+ if (!cronSecret) {
149150
+ return null;
149151
+ }
149152
+ if (cronSecret !== cronSecret.trim()) {
149153
+ return new NowBuildError5({
149154
+ code: "INVALID_CRON_SECRET",
149155
+ message: "The `CRON_SECRET` environment variable contains leading or trailing whitespace, which is not allowed in HTTP header values.",
149156
+ link: "https://vercel.link/securing-cron-jobs",
149157
+ action: "Learn More"
149158
+ });
149159
+ }
149160
+ const invalidChars = [];
149161
+ for (let i = 0; i < cronSecret.length; i++) {
149162
+ const code2 = cronSecret.charCodeAt(i);
149163
+ const isValidChar = code2 === 9 || // HTAB
149164
+ code2 >= 32 && code2 <= 126;
149165
+ if (!isValidChar) {
149166
+ invalidChars.push({
149167
+ char: cronSecret[i],
149168
+ index: i,
149169
+ code: code2
149170
+ });
149171
+ }
149172
+ }
149173
+ if (invalidChars.length > 0) {
149174
+ const descriptions = invalidChars.slice(0, 3).map(({ code: code2, index }) => {
149175
+ if (code2 < 32) {
149176
+ return `control character (0x${code2.toString(16).padStart(2, "0")}) at position ${index}`;
149177
+ } else if (code2 === 127) {
149178
+ return `DEL character at position ${index}`;
149179
+ } else {
149180
+ return `non-ASCII character (0x${code2.toString(16).padStart(2, "0")}) at position ${index}`;
149181
+ }
149182
+ });
149183
+ const moreCount = invalidChars.length - 3;
149184
+ const moreText = moreCount > 0 ? `, and ${moreCount} more` : "";
149185
+ return new NowBuildError5({
149186
+ code: "INVALID_CRON_SECRET",
149187
+ message: `The \`CRON_SECRET\` environment variable contains characters that are not valid in HTTP headers: ${descriptions.join(", ")}${moreText}. Only visible ASCII characters (letters, digits, symbols), spaces, and tabs are allowed.`,
149188
+ link: "https://vercel.link/securing-cron-jobs",
149189
+ action: "Learn More"
149190
+ });
149191
+ }
149192
+ return null;
149193
+ }
149194
+ var init_validate_cron_secret = __esm({
149195
+ "src/util/validate-cron-secret.ts"() {
149196
+ "use strict";
149197
+ }
149198
+ });
149199
+
149146
149200
  // src/util/input/input-project.ts
149147
149201
  async function inputProject(client2, org, detectedProjectName, autoConfirm = false) {
149148
149202
  const slugifiedName = (0, import_slugify2.default)(detectedProjectName);
@@ -150018,7 +150072,7 @@ import {
150018
150072
  getDiscontinuedNodeVersions,
150019
150073
  getInstalledPackageVersion,
150020
150074
  normalizePath as normalizePath3,
150021
- NowBuildError as NowBuildError5,
150075
+ NowBuildError as NowBuildError6,
150022
150076
  runNpmInstall,
150023
150077
  runCustomInstallCommand,
150024
150078
  resetCustomInstallCommandSet,
@@ -150227,6 +150281,7 @@ async function main3(client2) {
150227
150281
  }
150228
150282
  async function doBuild(client2, project, buildsJson, cwd, outputDir, span, standalone = false) {
150229
150283
  const { localConfigPath } = client2;
150284
+ const VALID_DEPLOYMENT_ID_PATTERN = /^[a-zA-Z0-9_-]+$/;
150230
150285
  const workPath = join16(cwd, project.settings.rootDirectory || ".");
150231
150286
  const sourceConfigFile = await findSourceVercelConfigFile(workPath);
150232
150287
  let corepackShimDir;
@@ -150287,13 +150342,19 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
150287
150342
  if (validateError) {
150288
150343
  throw validateError;
150289
150344
  }
150345
+ if (localConfig.crons && localConfig.crons.length > 0) {
150346
+ const cronSecretError = validateCronSecret(process.env.CRON_SECRET);
150347
+ if (cronSecretError) {
150348
+ throw cronSecretError;
150349
+ }
150350
+ }
150290
150351
  if (localConfig.customErrorPage) {
150291
150352
  const errorPages = typeof localConfig.customErrorPage === "string" ? [localConfig.customErrorPage] : Object.values(localConfig.customErrorPage);
150292
150353
  for (const page of errorPages) {
150293
150354
  if (page) {
150294
150355
  const src = join16(workPath, page);
150295
150356
  if (!(0, import_fs_extra18.existsSync)(src)) {
150296
- throw new NowBuildError5({
150357
+ throw new NowBuildError6({
150297
150358
  code: "CUSTOM_ERROR_PAGE_NOT_FOUND",
150298
150359
  message: `The custom error page "${page}" was not found in "${workPath}".`,
150299
150360
  link: "https://vercel.com/docs/projects/project-configuration#custom-error-page"
@@ -150317,7 +150378,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
150317
150378
  throw routesResult.error;
150318
150379
  }
150319
150380
  if (localConfig.builds && localConfig.functions) {
150320
- throw new NowBuildError5({
150381
+ throw new NowBuildError6({
150321
150382
  code: "bad_request",
150322
150383
  message: "The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",
150323
150384
  link: "https://vercel.link/functions-and-builds"
@@ -150495,7 +150556,7 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
150495
150556
  if (buildResult && "output" in buildResult && "runtime" in buildResult.output && "type" in buildResult.output && buildResult.output.type === "Lambda") {
150496
150557
  const lambdaRuntime = buildResult.output.runtime;
150497
150558
  if (getDiscontinuedNodeVersions().some((o) => o.runtime === lambdaRuntime)) {
150498
- throw new NowBuildError5({
150559
+ throw new NowBuildError6({
150499
150560
  code: "NODEJS_DISCONTINUED_VERSION",
150500
150561
  message: `The Runtime "${build2.use}" is using "${lambdaRuntime}", which is discontinued. Please upgrade your Runtime to a more recent version or consult the author for more details.`,
150501
150562
  link: "https://vercel.link/function-runtimes"
@@ -150628,19 +150689,26 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
150628
150689
  if ("deploymentId" in existingConfig && typeof existingConfig.deploymentId === "string") {
150629
150690
  const deploymentId = existingConfig.deploymentId;
150630
150691
  if (deploymentId.startsWith("dpl_")) {
150631
- throw new NowBuildError5({
150692
+ throw new NowBuildError6({
150632
150693
  code: "INVALID_DEPLOYMENT_ID",
150633
150694
  message: `The deploymentId "${deploymentId}" cannot start with the "dpl_" prefix. Please choose a different deploymentId in your config.`,
150634
150695
  link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
150635
150696
  });
150636
150697
  }
150637
150698
  if (deploymentId.length > 32) {
150638
- throw new NowBuildError5({
150699
+ throw new NowBuildError6({
150639
150700
  code: "INVALID_DEPLOYMENT_ID",
150640
150701
  message: `The deploymentId "${deploymentId}" must be 32 characters or less. Please choose a shorter deploymentId in your config.`,
150641
150702
  link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
150642
150703
  });
150643
150704
  }
150705
+ if (!VALID_DEPLOYMENT_ID_PATTERN.test(deploymentId)) {
150706
+ throw new NowBuildError6({
150707
+ code: "INVALID_DEPLOYMENT_ID",
150708
+ message: `The deploymentId "${deploymentId}" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed.`,
150709
+ link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
150710
+ });
150711
+ }
150644
150712
  }
150645
150713
  if (existingConfig.overrides) {
150646
150714
  overrides.push(existingConfig.overrides);
@@ -150676,25 +150744,33 @@ async function doBuild(client2, project, buildsJson, cwd, outputDir, span, stand
150676
150744
  const mergedImages = mergeImages(localConfig.images, buildResults.values());
150677
150745
  const mergedCrons = mergeCrons(localConfig.crons, buildResults.values());
150678
150746
  const mergedWildcard = mergeWildcard(buildResults.values());
150679
- const mergedDeploymentId = mergeDeploymentId(
150747
+ const mergedDeploymentId = await mergeDeploymentId(
150680
150748
  existingConfig?.deploymentId,
150681
- buildResults.values()
150749
+ buildResults.values(),
150750
+ workPath
150682
150751
  );
150683
150752
  if (mergedDeploymentId) {
150684
150753
  if (mergedDeploymentId.startsWith("dpl_")) {
150685
- throw new NowBuildError5({
150754
+ throw new NowBuildError6({
150686
150755
  code: "INVALID_DEPLOYMENT_ID",
150687
150756
  message: `The deploymentId "${mergedDeploymentId}" cannot start with the "dpl_" prefix. Please choose a different deploymentId in your config.`,
150688
150757
  link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
150689
150758
  });
150690
150759
  }
150691
150760
  if (mergedDeploymentId.length > 32) {
150692
- throw new NowBuildError5({
150761
+ throw new NowBuildError6({
150693
150762
  code: "INVALID_DEPLOYMENT_ID",
150694
150763
  message: `The deploymentId "${mergedDeploymentId}" must be 32 characters or less. Please choose a shorter deploymentId in your config.`,
150695
150764
  link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
150696
150765
  });
150697
150766
  }
150767
+ if (!VALID_DEPLOYMENT_ID_PATTERN.test(mergedDeploymentId)) {
150768
+ throw new NowBuildError6({
150769
+ code: "INVALID_DEPLOYMENT_ID",
150770
+ message: `The deploymentId "${mergedDeploymentId}" contains invalid characters. Only alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (_) are allowed.`,
150771
+ link: "https://vercel.com/docs/skew-protection#custom-skew-protection-deployment-id"
150772
+ });
150773
+ }
150698
150774
  }
150699
150775
  const mergedOverrides = overrides.length > 0 ? Object.assign({}, ...overrides) : void 0;
150700
150776
  const framework = await getFramework(workPath, buildResults);
@@ -150752,7 +150828,7 @@ async function getFramework(cwd, buildResults) {
150752
150828
  }
150753
150829
  function expandBuild(files, build2) {
150754
150830
  if (!build2.use) {
150755
- throw new NowBuildError5({
150831
+ throw new NowBuildError6({
150756
150832
  code: `invalid_build_specification`,
150757
150833
  message: "Field `use` is missing in build specification",
150758
150834
  link: "https://vercel.com/docs/concepts/projects/project-configuration#builds",
@@ -150761,7 +150837,7 @@ function expandBuild(files, build2) {
150761
150837
  }
150762
150838
  let src = normalize3(build2.src || "**").split(sep2).join("/");
150763
150839
  if (src === "." || src === "./") {
150764
- throw new NowBuildError5({
150840
+ throw new NowBuildError6({
150765
150841
  code: `invalid_build_specification`,
150766
150842
  message: "A build `src` path resolves to an empty string",
150767
150843
  link: "https://vercel.com/docs/concepts/projects/project-configuration#builds",
@@ -150808,7 +150884,7 @@ function mergeWildcard(buildResults) {
150808
150884
  }
150809
150885
  return wildcard;
150810
150886
  }
150811
- function mergeDeploymentId(existingDeploymentId, buildResults) {
150887
+ async function mergeDeploymentId(existingDeploymentId, buildResults, workPath) {
150812
150888
  if (existingDeploymentId) {
150813
150889
  return existingDeploymentId;
150814
150890
  }
@@ -150817,6 +150893,20 @@ function mergeDeploymentId(existingDeploymentId, buildResults) {
150817
150893
  return result.deploymentId;
150818
150894
  }
150819
150895
  }
150896
+ try {
150897
+ const routesManifestPath = join16(workPath, ".next", "routes-manifest.json");
150898
+ if (await import_fs_extra18.default.pathExists(routesManifestPath)) {
150899
+ const routesManifest = await readJSONFile(
150900
+ routesManifestPath
150901
+ );
150902
+ if (routesManifest && !(routesManifest instanceof CantParseJSONFile)) {
150903
+ if (routesManifest.deploymentId) {
150904
+ return routesManifest.deploymentId;
150905
+ }
150906
+ }
150907
+ }
150908
+ } catch {
150909
+ }
150820
150910
  return void 0;
150821
150911
  }
150822
150912
  async function writeFlagsJSON(buildResults, outputDir) {
@@ -150895,6 +150985,7 @@ var init_build2 = __esm({
150895
150985
  init_read_json_file();
150896
150986
  init_build();
150897
150987
  init_validate_config();
150988
+ init_validate_cron_secret();
150898
150989
  init_compile_vercel_config();
150899
150990
  init_help();
150900
150991
  init_pull4();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "50.3.2",
3
+ "version": "50.3.3",
4
4
  "type": "module",
5
5
  "preferGlobal": true,
6
6
  "license": "Apache-2.0",
@@ -28,26 +28,26 @@
28
28
  "esbuild": "0.27.0",
29
29
  "form-data": "^4.0.0",
30
30
  "jose": "5.9.6",
31
- "@vercel/build-utils": "13.2.7",
32
- "@vercel/backends": "0.0.20",
31
+ "@vercel/build-utils": "13.2.8",
33
32
  "@vercel/detect-agent": "1.0.0",
34
- "@vercel/express": "0.1.25",
35
- "@vercel/elysia": "0.1.18",
36
- "@vercel/fastify": "0.1.21",
33
+ "@vercel/elysia": "0.1.19",
34
+ "@vercel/express": "0.1.26",
35
+ "@vercel/fastify": "0.1.22",
37
36
  "@vercel/go": "3.3.0",
38
- "@vercel/h3": "0.1.27",
39
- "@vercel/hono": "0.2.21",
40
- "@vercel/hydrogen": "1.3.4",
41
- "@vercel/koa": "0.1.1",
42
- "@vercel/nestjs": "0.2.22",
43
- "@vercel/node": "5.5.19",
44
- "@vercel/next": "4.15.13",
37
+ "@vercel/h3": "0.1.28",
38
+ "@vercel/hono": "0.2.22",
39
+ "@vercel/hydrogen": "1.3.5",
40
+ "@vercel/koa": "0.1.2",
41
+ "@vercel/nestjs": "0.2.23",
42
+ "@vercel/node": "5.5.20",
43
+ "@vercel/next": "4.15.14",
44
+ "@vercel/redwood": "2.4.8",
45
45
  "@vercel/python": "6.1.6",
46
- "@vercel/redwood": "2.4.7",
47
- "@vercel/remix-builder": "5.5.7",
48
- "@vercel/ruby": "2.2.4",
46
+ "@vercel/remix-builder": "5.5.8",
49
47
  "@vercel/rust": "1.0.4",
50
- "@vercel/static-build": "2.8.18"
48
+ "@vercel/ruby": "2.2.4",
49
+ "@vercel/static-build": "2.8.19",
50
+ "@vercel/backends": "0.0.21"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@alex_neo/jest-expect-message": "1.0.5",
@@ -174,7 +174,7 @@
174
174
  "@vercel-internals/constants": "1.0.4",
175
175
  "@vercel-internals/get-package-json": "1.0.0",
176
176
  "@vercel-internals/types": "3.0.6",
177
- "@vercel/client": "17.2.21",
177
+ "@vercel/client": "17.2.22",
178
178
  "@vercel/error-utils": "2.0.3",
179
179
  "@vercel/frameworks": "3.15.5",
180
180
  "@vercel/fs-detectors": "5.7.13",