docs: record what a deployment with a failing Composer script servesUnverified
Measured on Scaleway: the new code is always served, with a complete vendor/ after a failing post-install-cmd and none after a failing install, while the function stays ready and Composer's output shows nowhere.
fdc6e0c parent: c239eb0 modified
README.md +8 -5 | @@ -523,17 +523,20 @@ Headers whose name holds an underscore (`X_Real_Ip`) are dropped, as nginx and A | ||
| 523 | 523 | |
| 524 | 524 | Scaleway runs `composer install --no-dev` in the function's directory when the zip holds a `composer.json` at its root, replacing any shipped `vendor/`. |
| 525 | 525 | Every locked package must therefore be downloadable from Scaleway, and the function's environment variables are not available to Composer scripts. |
| 526 | -A failing install or script does not fail the deployment: the function becomes `ready` anyway, so check its first Invocations after a deploy. | |
| 526 | +A failing install or script does not fail the deployment, and Scaleway serves the new code anyway, never the previous version ([measured](docs/probe-results.md#failed-scripts-and-installs)): | |
| 527 | + | |
| 528 | +- a failing script runs once `vendor/` and its autoloader are complete, so the new code works, without what the script should have done (a warmed cache, generated files...); | |
| 529 | +- a failing install leaves no `vendor/` at all: every Invocation answers a `500`, and logs `Failed to open stream` for `vendor/autoload.php` on stdout. | |
| 530 | + | |
| 531 | +Neither shows anywhere: the function is `ready`, its `error_message` and `build_message` stay empty, and Composer's output reaches neither Cockpit nor `scw`. | |
| 532 | +So after each deploy, call the function and check its [logs](#logs). | |
| 533 | +Keep deploy-time scripts to what the application can do without, as a cache warmup the first Invocation redoes, and run whatever it needs at runtime instead. | |
| 527 | 534 | |
| 528 | 535 | ### Windows |
| 529 | 536 | |
| 530 | 537 | `scaleway-serve` relies on Unix sockets: it runs on macOS and Linux, not on Windows outside WSL, and `scaleway-package` is only tested on macOS and Linux. |
| 531 | 538 | Without the `pcntl` extension, stopping the Emulator with `kill` may leave its PHP processes running. |
| 532 | 539 | |
| 533 | -### Not measured | |
| 534 | - | |
| 535 | -The [probe](probe) settled every platform fact the runtime relies on ([results](docs/probe-results.md)), except whether a deployment whose Composer install or script fails serves the new code or keeps the previous version. | |
| 536 | - | |
| 537 | 540 | ## Contributing |
| 538 | 541 | |
| 539 | 542 | ```sh |
| @@ -523,17 +523,20 @@ Headers whose name holds an underscore (`X_Real_Ip`) are dropped, as nginx and A | |||
| 523 | 523 | ||
| 524 | Scaleway runs `composer install --no-dev` in the function's directory when the zip holds a `composer.json` at its root, replacing any shipped `vendor/`. | 524 | Scaleway runs `composer install --no-dev` in the function's directory when the zip holds a `composer.json` at its root, replacing any shipped `vendor/`. |
| 525 | Every locked package must therefore be downloadable from Scaleway, and the function's environment variables are not available to Composer scripts. | 525 | Every locked package must therefore be downloadable from Scaleway, and the function's environment variables are not available to Composer scripts. |
| 526 | -A failing install or script does not fail the deployment: the function becomes `ready` anyway, so check its first Invocations after a deploy. | 526 | +A failing install or script does not fail the deployment, and Scaleway serves the new code anyway, never the previous version ([measured](docs/probe-results.md#failed-scripts-and-installs)): |
| 527 | + | ||
| 528 | +- a failing script runs once `vendor/` and its autoloader are complete, so the new code works, without what the script should have done (a warmed cache, generated files...); | ||
| 529 | +- a failing install leaves no `vendor/` at all: every Invocation answers a `500`, and logs `Failed to open stream` for `vendor/autoload.php` on stdout. | ||
| 530 | + | ||
| 531 | +Neither shows anywhere: the function is `ready`, its `error_message` and `build_message` stay empty, and Composer's output reaches neither Cockpit nor `scw`. | ||
| 532 | +So after each deploy, call the function and check its [logs](#logs). | ||
| 533 | +Keep deploy-time scripts to what the application can do without, as a cache warmup the first Invocation redoes, and run whatever it needs at runtime instead. | ||
| 527 | 534 | ||
| 528 | ### Windows | 535 | ### Windows |
| 529 | 536 | ||
| 530 | `scaleway-serve` relies on Unix sockets: it runs on macOS and Linux, not on Windows outside WSL, and `scaleway-package` is only tested on macOS and Linux. | 537 | `scaleway-serve` relies on Unix sockets: it runs on macOS and Linux, not on Windows outside WSL, and `scaleway-package` is only tested on macOS and Linux. |
| 531 | Without the `pcntl` extension, stopping the Emulator with `kill` may leave its PHP processes running. | 538 | Without the `pcntl` extension, stopping the Emulator with `kill` may leave its PHP processes running. |
| 532 | 539 | ||
| 533 | -### Not measured | ||
| 534 | - | ||
| 535 | -The [probe](probe) settled every platform fact the runtime relies on ([results](docs/probe-results.md)), except whether a deployment whose Composer install or script fails serves the new code or keeps the previous version. | ||
| 536 | - | ||
| 537 | ## Contributing | 540 | ## Contributing |
| 538 | 541 | ||
| 539 | ```sh | 542 | ```sh |
modified
docs/plan.md +4 -2 | @@ -58,5 +58,7 @@ For that, the example logs from the `info` level to stderr, and no longer logs t | ||
| 58 | 58 | |
| 59 | 59 | Absolute URLs were then verified on that deployment, without `host`, with its `domain_name` and with a custom-domain-like value ([probe results](probe-results.md#absolute-urls)): the router, `getUri()` and redirects carry the `host`, never a forged `X-Forwarded-Host`, and `framework.trusted_hosts` answers a 400 until `host` matches it. |
| 60 | 60 | |
| 61 | -1. Measure what the probe left open: what a deployment with a failing Composer script serves. | |
| 62 | - Where logs go was measured on 2026-11-14 ([probe results](probe-results.md#logs)): the runtime's stderr lines reach Cockpit one entry per line, with a `DEBUG - ` prefix and a ` source=user stream=stderr` suffix. | |
| 61 | +Where logs go was measured on 2026-11-14 ([probe results](probe-results.md#logs)): the runtime's stderr lines reach Cockpit one entry per line, with a `DEBUG - ` prefix and a ` source=user stream=stderr` suffix. | |
| 62 | +What a deployment whose Composer script or install fails serves was then measured ([probe results](probe-results.md#failed-scripts-and-installs)): always the new code, with a working `vendor/` after a failing script and none after a failing install, the function being `ready` and Composer's output shown nowhere. | |
| 63 | + | |
| 64 | +Nothing remains. | |
| @@ -58,5 +58,7 @@ For that, the example logs from the `info` level to stderr, and no longer logs t | |||
| 58 | 58 | ||
| 59 | Absolute URLs were then verified on that deployment, without `host`, with its `domain_name` and with a custom-domain-like value ([probe results](probe-results.md#absolute-urls)): the router, `getUri()` and redirects carry the `host`, never a forged `X-Forwarded-Host`, and `framework.trusted_hosts` answers a 400 until `host` matches it. | 59 | Absolute URLs were then verified on that deployment, without `host`, with its `domain_name` and with a custom-domain-like value ([probe results](probe-results.md#absolute-urls)): the router, `getUri()` and redirects carry the `host`, never a forged `X-Forwarded-Host`, and `framework.trusted_hosts` answers a 400 until `host` matches it. |
| 60 | 60 | ||
| 61 | -1. Measure what the probe left open: what a deployment with a failing Composer script serves. | 61 | +Where logs go was measured on 2026-11-14 ([probe results](probe-results.md#logs)): the runtime's stderr lines reach Cockpit one entry per line, with a `DEBUG - ` prefix and a ` source=user stream=stderr` suffix. |
| 62 | - Where logs go was measured on 2026-11-14 ([probe results](probe-results.md#logs)): the runtime's stderr lines reach Cockpit one entry per line, with a `DEBUG - ` prefix and a ` source=user stream=stderr` suffix. | 62 | +What a deployment whose Composer script or install fails serves was then measured ([probe results](probe-results.md#failed-scripts-and-installs)): always the new code, with a working `vendor/` after a failing script and none after a failing install, the function being `ready` and Composer's output shown nowhere. |
| 63 | + | ||
| 64 | +Nothing remains. | ||
modified
docs/probe-results.md +19 -4 | @@ -23,6 +23,25 @@ Client addresses are replaced with documentation addresses (`2001:db8::1`, `203. | ||
| 23 | 23 | - A failing Composer script does not fail the deployment: the function still becomes `ready`. |
| 24 | 24 | - With `composer.json` and `vendor/` in a subdirectory instead of the zip root, Scaleway does not run Composer and keeps the shipped `vendor/`. |
| 25 | 25 | |
| 26 | +### Failed scripts and installs | |
| 27 | + | |
| 28 | +Measured on 2026-11-14 on `php85` with a scratch function requiring `psr/log`, whose `handler.php` answers a version string set per zip, whether `vendor/autoload.php` loads `Psr\Log\LoggerInterface`, and the marker a `post-install-cmd` writes; the function was deployed with Terraform, one zip after the other, and a second function deployed once. | |
| 29 | + | |
| 30 | +| Deployment | Function after the apply | What answers | | |
| 31 | +| --- | --- | --- | | |
| 32 | +| Second function, first deployment, `post-install-cmd` writing its marker then exiting `1` | `ready`, `error_message` and `build_message` null | The new code, with a complete `vendor/` and a working autoloader, and the script's marker | | |
| 33 | +| `v1`, scripts succeeding | `ready` | `v1`, with `vendor/` and the marker | | |
| 34 | +| `v2` over `v1`, `post-install-cmd` writing its marker then exiting `1` | `ready`, `error_message` and `build_message` null | `v2`, with a complete `vendor/` and a working autoloader, and `v2`'s marker | | |
| 35 | +| `v3` over `v2`, the lock also installing a package whose dist URL does not resolve | `ready`, `error_message` and `build_message` null | `v3`, without any `vendor/` nor marker: the zip's files only | | |
| 36 | +| `v4` over `v3`, the same failing lock, with a `handler.php` requiring `vendor/autoload.php` first as the one `scaleway-init` writes | `ready` | `500` with `Error 500: Internal Server Error`, and the log line `Warning: require(/home/app/function/vendor/autoload.php): Failed to open stream: No such file or directory in /home/app/function/handler.php on line 4` on stdout; later Invocations answered, as this `handle()` uses nothing from `vendor/` | | |
| 37 | + | |
| 38 | +- A deployment always serves the new zip: Scaleway never keeps the previous version, whatever Composer does. | |
| 39 | +- `post-install-cmd` runs once `vendor/` and its autoloader are complete, as with a local `composer install`, so a failing script leaves a working install behind. | |
| 40 | +- A failing install leaves no `vendor/` at all, Composer downloading every package before installing any. | |
| 41 | + The runtime's `Handler` being in `vendor/`, every Invocation of an application then fails. | |
| 42 | +- Nothing tells a failed deployment from a successful one: the status, `error_message`, `build_message` and `runtime_message` (empty) are the same, and Composer's output reaches neither Cockpit (no entry under the function's `resource_id`, nor anywhere in the project's logs) nor any `scw function` command. | |
| 43 | +- The new instance logs `Function is not ready to serve requests yet...` and `Function is now ready to serve requests!` as usual, and the previous one `Forked function has terminated` about 40 seconds later. | |
| 44 | + | |
| 26 | 45 | ## HTTP Event |
| 27 | 46 | |
| 28 | 47 | Keys: `resource`, `path`, `httpMethod`, `headers`, `multiValueHeaders` (null), `queryStringParameters`, `multiValueQueryStringParameters` (null), `pathParameters` (null), `stageVariables`, `requestContext` (with `httpMethod`), `body`, `isBase64Encoded`. |
| @@ -152,7 +171,3 @@ Measured with the Loki HTTP API of the project's `Scaleway Logs` data source (`s | ||
| 152 | 171 | ## Terraform |
| 153 | 172 | |
| 154 | 173 | - Replacing a function (for example changing `runtime`) deletes its CRON triggers server side; Terraform recreates them only on the next apply. |
| 155 | - | |
| 156 | -## Not measured | |
| 157 | - | |
| 158 | -- Whether a deployment with a failing Composer script serves the new code or keeps the previous version. | |
| @@ -23,6 +23,25 @@ Client addresses are replaced with documentation addresses (`2001:db8::1`, `203. | |||
| 23 | - A failing Composer script does not fail the deployment: the function still becomes `ready`. | 23 | - A failing Composer script does not fail the deployment: the function still becomes `ready`. |
| 24 | - With `composer.json` and `vendor/` in a subdirectory instead of the zip root, Scaleway does not run Composer and keeps the shipped `vendor/`. | 24 | - With `composer.json` and `vendor/` in a subdirectory instead of the zip root, Scaleway does not run Composer and keeps the shipped `vendor/`. |
| 25 | 25 | ||
| 26 | +### Failed scripts and installs | ||
| 27 | + | ||
| 28 | +Measured on 2026-11-14 on `php85` with a scratch function requiring `psr/log`, whose `handler.php` answers a version string set per zip, whether `vendor/autoload.php` loads `Psr\Log\LoggerInterface`, and the marker a `post-install-cmd` writes; the function was deployed with Terraform, one zip after the other, and a second function deployed once. | ||
| 29 | + | ||
| 30 | +| Deployment | Function after the apply | What answers | | ||
| 31 | +| --- | --- | --- | | ||
| 32 | +| Second function, first deployment, `post-install-cmd` writing its marker then exiting `1` | `ready`, `error_message` and `build_message` null | The new code, with a complete `vendor/` and a working autoloader, and the script's marker | | ||
| 33 | +| `v1`, scripts succeeding | `ready` | `v1`, with `vendor/` and the marker | | ||
| 34 | +| `v2` over `v1`, `post-install-cmd` writing its marker then exiting `1` | `ready`, `error_message` and `build_message` null | `v2`, with a complete `vendor/` and a working autoloader, and `v2`'s marker | | ||
| 35 | +| `v3` over `v2`, the lock also installing a package whose dist URL does not resolve | `ready`, `error_message` and `build_message` null | `v3`, without any `vendor/` nor marker: the zip's files only | | ||
| 36 | +| `v4` over `v3`, the same failing lock, with a `handler.php` requiring `vendor/autoload.php` first as the one `scaleway-init` writes | `ready` | `500` with `Error 500: Internal Server Error`, and the log line `Warning: require(/home/app/function/vendor/autoload.php): Failed to open stream: No such file or directory in /home/app/function/handler.php on line 4` on stdout; later Invocations answered, as this `handle()` uses nothing from `vendor/` | | ||
| 37 | + | ||
| 38 | +- A deployment always serves the new zip: Scaleway never keeps the previous version, whatever Composer does. | ||
| 39 | +- `post-install-cmd` runs once `vendor/` and its autoloader are complete, as with a local `composer install`, so a failing script leaves a working install behind. | ||
| 40 | +- A failing install leaves no `vendor/` at all, Composer downloading every package before installing any. | ||
| 41 | + The runtime's `Handler` being in `vendor/`, every Invocation of an application then fails. | ||
| 42 | +- Nothing tells a failed deployment from a successful one: the status, `error_message`, `build_message` and `runtime_message` (empty) are the same, and Composer's output reaches neither Cockpit (no entry under the function's `resource_id`, nor anywhere in the project's logs) nor any `scw function` command. | ||
| 43 | +- The new instance logs `Function is not ready to serve requests yet...` and `Function is now ready to serve requests!` as usual, and the previous one `Forked function has terminated` about 40 seconds later. | ||
| 44 | + | ||
| 26 | ## HTTP Event | 45 | ## HTTP Event |
| 27 | 46 | ||
| 28 | Keys: `resource`, `path`, `httpMethod`, `headers`, `multiValueHeaders` (null), `queryStringParameters`, `multiValueQueryStringParameters` (null), `pathParameters` (null), `stageVariables`, `requestContext` (with `httpMethod`), `body`, `isBase64Encoded`. | 47 | Keys: `resource`, `path`, `httpMethod`, `headers`, `multiValueHeaders` (null), `queryStringParameters`, `multiValueQueryStringParameters` (null), `pathParameters` (null), `stageVariables`, `requestContext` (with `httpMethod`), `body`, `isBase64Encoded`. |
| @@ -152,7 +171,3 @@ Measured with the Loki HTTP API of the project's `Scaleway Logs` data source (`s | |||
| 152 | ## Terraform | 171 | ## Terraform |
| 153 | 172 | ||
| 154 | - Replacing a function (for example changing `runtime`) deletes its CRON triggers server side; Terraform recreates them only on the next apply. | 173 | - Replacing a function (for example changing `runtime`) deletes its CRON triggers server side; Terraform recreates them only on the next apply. |
| 155 | - | ||
| 156 | -## Not measured | ||
| 157 | - | ||
| 158 | -- Whether a deployment with a failing Composer script serves the new code or keeps the previous version. | ||