Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(vercel): Add beta option for status #9413

Merged
5 changes: 5 additions & 0 deletions .changeset/stupid-cheetahs-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': patch
jacobdalamb marked this conversation as resolved.
Show resolved Hide resolved
---

Update supported Node versions and add `beta` option.
florian-lefebvre marked this conversation as resolved.
Show resolved Hide resolved
jacobdalamb marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 9 additions & 2 deletions packages/integrations/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export const VERCEL_EDGE_MIDDLEWARE_FILE = 'vercel-edge-middleware';
// https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-version
const SUPPORTED_NODE_VERSIONS: Record<
string,
{ status: 'current' } | { status: 'deprecated'; removal: Date }
{ status: 'current' } | { status: 'beta' } | { status: 'deprecated'; removal: Date }
> = {
14: { status: 'deprecated', removal: new Date('August 15 2023') },
16: { status: 'deprecated', removal: new Date('February 6 2024') },
18: { status: 'current' },
20: { status: 'beta' },
};

function getAdapter({
Expand Down Expand Up @@ -377,6 +377,13 @@ 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 by Vercel Serverless Functions.`
jacobdalamb marked this conversation as resolved.
Show resolved Hide resolved
);
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 Down
Loading