Skip to content

Commit ececd75

Browse files
authored
Node 22 support, php 8.1.31, binary file handling improvements
1 parent 14cf402 commit ececd75

7 files changed

Lines changed: 21 additions & 12 deletions

File tree

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "",
55
"license": "MIT",
66
"dependencies": {
7-
"serverlesswp": "^0.1.2"
7+
"serverlesswp": "^0.2.0"
88
},
99
"engines": {
10-
"node": "18.x"
10+
"node": "22.x"
1111
}
1212
}

serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ service: serverlesswp-wordpress-starter
22

33
provider:
44
name: aws
5-
runtime: nodejs18.x
5+
runtime: nodejs22.x
66
httpApi:
77
payload: '2.0'
88

test/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM public.ecr.aws/lambda/nodejs:18
1+
FROM public.ecr.aws/lambda/nodejs:22
22

33
COPY package.json ${LAMBDA_TASK_ROOT}/
44
RUN npm install --omit=optional --omit=dev
@@ -12,6 +12,4 @@ COPY test/installer.php ${LAMBDA_TASK_ROOT}/wp/
1212

1313
RUN sed -i 's#{SQLITE_IMPLEMENTATION_FOLDER_PATH}#/tmp/wp/wp-content/plugins/sqlite-database-integration#' ${LAMBDA_TASK_ROOT}/wp/wp-content/db.php
1414

15-
RUN echo "define('FQDBDIR', '/tmp/db' );" >> ${LAMBDA_TASK_ROOT}/wp/wp-config.php
16-
1715
CMD [ "api/index.handler" ]

test/run.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
./build-test.sh
44

5-
docker run -p 9000:8080 -d -e FQDBDIR='/tmp/db' --name serverlesswp-test serverlesswp-test
5+
docker run -e FQDBDIR=/tmp/db -p 9000:8080 -d --name serverlesswp-test serverlesswp-test
66

7-
curl -s -o /dev/null -w "%{http_code}" -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"path":"/installer.php"}'
7+
curl -s -o /dev/null -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"path":"/installer.php"}'
8+
9+
curl -s -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"path":"/"}'
810

9-
curl -s -o /dev/null -w "%{http_code}" -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"path":"/"}'
1011

1112
docker stop serverlesswp-test
1213
docker rm serverlesswp-test

vercel.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
],
55
"functions": {
66
"api/index.js": {
7-
"memory": 1024,
8-
"includeFiles": "wp/**"
7+
"includeFiles": "wp/**",
8+
"maxDuration": 60
99
}
1010
},
1111
"build": {

wp/wp-config.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,18 @@
9191

9292
/* Add any custom values between this line and the "stop editing" line. */
9393

94-
define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL );
94+
if (!isset($_ENV['SKIP_MYSQL_SSL'])) {
95+
define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL );
96+
}
97+
9598
$_SERVER['HTTPS'] = 'on';
9699

100+
// Inject the true host.
101+
$headers = getallheaders();
102+
if (isset($headers['injectHost'])) {
103+
$_SERVER['HTTP_HOST'] = $headers['injectHost'];
104+
}
105+
97106
// Optional S3 credentials for file storage.
98107
if (isset($_ENV['S3_KEY_ID']) && isset($_ENV['S3_ACCESS_KEY'])) {
99108
define( 'AS3CF_SETTINGS', serialize( array(

0 commit comments

Comments
 (0)