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

fix: update vercel node support status #10611

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clever-houses-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/vercel": patch
---

Update supported Node version
jacobdalamb marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 10 additions & 5 deletions packages/integrations/vercel/src/serverless/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ const ISR_PATH = `/_isr?${ASTRO_PATH_PARAM}=$0`;
// https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-version
const SUPPORTED_NODE_VERSIONS: Record<
string,
{ status: 'current' } | { status: 'beta' } | { status: 'deprecated'; removal: Date }
{ status: 'default' } | { status: 'beta' } | { status: 'retiring'; removal: Date | string; warnDate: Date } | { status: 'deprecated'; removal: Date }
> = {
16: { status: 'deprecated', removal: new Date('February 6 2024') },
18: { status: 'current' },
20: { status: 'beta' },
18: { status: 'retiring', removal: "Early 2025", warnDate: new Date('October 1 2024') },
ematipico marked this conversation as resolved.
Show resolved Hide resolved
20: { status: 'default' },
};

function getAdapter({
Expand Down Expand Up @@ -522,9 +521,15 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
);
return 'nodejs18.x';
}
if (support.status === 'current') {
if (support.status === 'default') {
return `nodejs${major}.x`;
}
if (support.status === 'retiring' && support.warnDate && new Date() >= support.warnDate) {
logger.warn(
`Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.`
);
return `nodejs${major}.x`;
}
jacobdalamb marked this conversation as resolved.
Show resolved Hide resolved
if (support.status === 'beta') {
logger.warn(
`Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.`
Expand Down
Loading