Skip to content

Commit

Permalink
fix(vercel): prevent build failure with node 21 (#9550)
Browse files Browse the repository at this point in the history
* fix(vercel): prevent build failure with node 21

* add changeset
  • Loading branch information
lilnasy authored Dec 29, 2023
1 parent 48f47b5 commit 7b586a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-yaks-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/vercel": patch
---

Fixes an issue where a build could not complete on Node 21.
14 changes: 7 additions & 7 deletions packages/integrations/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,6 @@ function validateRuntime() {
const version = process.version.slice(1); // 'v16.5.0' --> '16.5.0'
const major = version.split('.')[0]; // '16.5.0' --> '16'
const support = SUPPORTED_NODE_VERSIONS[major];
if (support.status === 'beta') {
console.warn(
`[${PACKAGE_NAME}] The local Node.js version (${major}) is currently in beta for Vercel Serverless Functions.`
);
console.warn(`[${PACKAGE_NAME}] Make sure to update your Vercel settings to use ${major}.`);
return;
}
if (support === undefined) {
console.warn(
`[${PACKAGE_NAME}] The local Node.js version (${major}) is not supported by Vercel Serverless Functions.`
Expand All @@ -392,6 +385,13 @@ function validateRuntime() {
console.warn(`[${PACKAGE_NAME}] Consider switching your local version to 18.`);
return;
}
if (support.status === 'beta') {
console.warn(
`[${PACKAGE_NAME}] The local Node.js version (${major}) is currently in beta for Vercel Serverless Functions.`
);
console.warn(`[${PACKAGE_NAME}] Make sure to update your Vercel settings to use ${major}.`);
return;
}
if (support.status === 'deprecated') {
console.warn(
`[${PACKAGE_NAME}] Your project is being built for Node.js ${major} as the runtime.`
Expand Down

0 comments on commit 7b586a6

Please sign in to comment.