Skip to content

Commit a510f90

Browse files
committed
add support for Nodejs24, make Node24 the default for containers
1 parent 1f2dfd7 commit a510f90

File tree

13 files changed

+166
-48
lines changed

13 files changed

+166
-48
lines changed

@generated/schemas/config-schema.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

@generated/schemas/validate-config-schema.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default (event, context) => {
2+
console.log(event, context);
3+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineConfig, LambdaFunction, StacktapeLambdaBuildpackPackaging } from '../../__release-npm';
2+
3+
export default defineConfig(() => {
4+
const lambda = new LambdaFunction({
5+
packaging: new StacktapeLambdaBuildpackPackaging({
6+
entryfilePath: './src/simple.ts'
7+
}),
8+
url: {
9+
enabled: true,
10+
cors: {
11+
enabled: true
12+
}
13+
},
14+
runtime: 'nodejs24.x',
15+
provisionedConcurrency: 1
16+
});
17+
18+
return {
19+
resources: { lambda },
20+
};
21+
});

_test-stacks/simple-lambda/stacktape.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ export default defineConfig(() => {
1111
enabled: true
1212
}
1313
},
14-
provisionedConcurrency: 1,
1514
transforms: {
1615
lambda: (props) => {
1716
return {
1817
...props,
1918
MemorySize: (props.MemorySize ?? 128) * 2,
2019
Description: 'This is a test lambda',
21-
Layers: ['arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1'],
2220
}
2321
}
2422
}

bun.lock

Lines changed: 87 additions & 6 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
"devDependencies": {
160160
"@antfu/eslint-config": "^6.2.0",
161161
"@cspell/eslint-plugin": "^9.2.2",
162+
"@eslint-react/eslint-plugin": "^2.3.9",
162163
"@types/adm-zip": "^0.5.7",
163164
"@types/archiver": "^5.3.4",
164165
"@types/aws-lambda": "^8.10.152",
@@ -176,6 +177,8 @@
176177
"eslint": "^9.36.0",
177178
"eslint-config-prettier": "^10.1.8",
178179
"eslint-plugin-prettier": "^5.5.4",
180+
"eslint-plugin-react-hooks": "^7.0.1",
181+
"eslint-plugin-react-refresh": "^0.4.24",
179182
"inquirer": "^13.0.1",
180183
"json-schema-to-typescript": "^15.0.4",
181184
"nodejs-file-downloader": "^4.13.0",

shared/packaging/bundlers/es/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Plugin } from 'esbuild';
22
import type { PackageJsonDepsInfo } from './utils';
33
import { existsSync } from 'node:fs';
44
import { dirname, isAbsolute, join, resolve } from 'node:path';
5+
import { NODE_RUNTIME_VERSIONS_WITH_SKIPPED_SDK_V3_PACKAGING } from '@config';
56
import { SOURCE_MAP_INSTALL_DIST_PATH } from '@shared/naming/project-fs-paths';
67
import { dependencyInstaller } from '@shared/utils/dependency-installer';
78
import {
@@ -112,12 +113,9 @@ export const buildEsCode = async ({
112113
// @todo add option to use exact version (as-is in user's package json)
113114
const skipAwsSdkV3Deps =
114115
isLambda &&
115-
(nodeTarget.includes('18') ||
116-
String(nodeTarget) === '18' ||
117-
nodeTarget.includes('20') ||
118-
String(nodeTarget) === '20' ||
119-
nodeTarget.includes('22') ||
120-
String(nodeTarget) === '22');
116+
NODE_RUNTIME_VERSIONS_WITH_SKIPPED_SDK_V3_PACKAGING.some(
117+
(v) => nodeTarget.includes(String(v)) || String(nodeTarget) === String(v)
118+
);
121119

122120
const runBuild = async ({ dynamicallyImportedModules = [] }: { dynamicallyImportedModules?: string[] }) => {
123121
const allDependenciesToInstallInDocker: ModuleInfo[] = [];

shared/packaging/stacktape-es-image-buildpack.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { getFolder } from '@shared/utils/fs-utils';
55
import { outputFile } from 'fs-extra';
66
import objectHash from 'object-hash';
77
import { createEsBundle } from './bundlers/es';
8+
import { DEFAULT_CONTAINER_NODE_VERSION } from '@config';
89

910
export const buildUsingStacktapeEsImageBuildpack = async ({
1011
progressLogger,
@@ -50,7 +51,7 @@ export const buildUsingStacktapeEsImageBuildpack = async ({
5051
languageSpecificBundleOutput: bundlingOutput.languageSpecificBundleOutput,
5152
requiresGlibcBinaries,
5253
customDockerBuildCommands: otherProps.customDockerBuildCommands,
53-
nodeVersion: (languageSpecificConfig as EsLanguageSpecificConfig)?.nodeVersion || 18
54+
nodeVersion: (languageSpecificConfig as EsLanguageSpecificConfig)?.nodeVersion || DEFAULT_CONTAINER_NODE_VERSION
5455
});
5556
await progressLogger.finishEvent({ eventType: 'CREATE_DOCKERFILE' });
5657

src/config/random.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,22 @@ export const possiblySupportedLangExtensions = [
3636
'tsx'
3737
] as const;
3838

39+
export const NODE_RUNTIME_VERSIONS_WITH_SKIPPED_SDK_V3_PACKAGING = [24, 22, 20, 18];
40+
3941
export const lambdaRuntimesForFileExtension: {
4042
[_ext in (typeof possiblySupportedLangExtensions)[number]]: string[];
4143
} = {
42-
js: ['nodejs22.x', 'nodejs20.x', 'nodejs18.x', 'nodejs16.x'], // 'nodejs14.x', 'nodejs12.x'],
43-
ts: ['nodejs22.x', 'nodejs20.x', 'nodejs18.x', 'nodejs16.x'], // 'nodejs14.x', 'nodejs12.x'],
44-
mjs: ['nodejs22.x', 'nodejs20.x', 'nodejs18.x', 'nodejs16.x'], // 'nodejs14.x', 'nodejs12.x'],
45-
mts: ['nodejs22.x', 'nodejs20.x', 'nodejs18.x', 'nodejs16.x'], // 'nodejs14.x', 'nodejs12.x'],
46-
jsx: ['nodejs22.x', 'nodejs20.x', 'nodejs18.x', 'nodejs16.x'], // 'nodejs14.x', 'nodejs12.x'],
47-
tsx: ['nodejs22.x', 'nodejs20.x', 'nodejs18.x', 'nodejs16.x'], // 'nodejs14.x', 'nodejs12.x'],
48-
py: ['python3.13', 'python3.12', 'python3.11', 'python3.10', 'python3.9', 'python3.8'],
49-
java: ['java11', 'java8.al2', 'java8'],
50-
rb: ['ruby3.2'],
44+
js: ['nodejs24.x', 'nodejs22.x', 'nodejs20.x', 'nodejs18.x'],
45+
ts: ['nodejs24.x', 'nodejs22.x', 'nodejs20.x', 'nodejs18.x'],
46+
mjs: ['nodejs24.x', 'nodejs22.x', 'nodejs20.x', 'nodejs18.x'],
47+
mts: ['nodejs24.x', 'nodejs22.x', 'nodejs20.x', 'nodejs18.x'],
48+
jsx: ['nodejs24.x', 'nodejs22.x', 'nodejs20.x', 'nodejs18.x'],
49+
tsx: ['nodejs24.x', 'nodejs22.x', 'nodejs20.x', 'nodejs18.x'],
50+
py: ['python3.13', 'python3.12', 'python3.11', 'python3.10'],
51+
java: ['java21', 'java17', 'java11'],
52+
rb: ['ruby3.3'],
5153
go: ['provided.al2', 'provided.al2023'],
52-
cs: ['dotnet6', 'dotnet7']
54+
cs: ['dotnet8', 'dotnet6']
5355
};
5456
export const supportedWorkloadExtensions: (typeof possiblySupportedLangExtensions)[number][] = [
5557
'js',
@@ -73,6 +75,7 @@ export const MONITORING_FREQUENCY_SECONDS = 3.5;
7375
export const SENTRY_CAPTURE_EXCEPTION_WAIT_TIME_MS = 1500;
7476
export const DEFAULT_MAXIMUM_PARALLEL_ARTIFACT_UPLOADS = 10;
7577
export const DEFAULT_MAXIMUM_PARALLEL_BUCKET_SYNCS = 10;
78+
export const DEFAULT_CONTAINER_NODE_VERSION = 24;
7679

7780
// @todo
7881
export const linksMap = {

0 commit comments

Comments
 (0)