jdecool/scaleway-runtimepublic Fork
⑂ 46aa06f
Commits
⬇ Clone ▾
git clone https://git.rickub.com/jdecool/scaleway-runtime.git
git clone ssh://git@rickub.com/jdecool/scaleway-runtime.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

docs: ground the failed install advice on a real applicationUnverified

Measured on Scaleway with an application requiring the runtime from
Packagist: after a failed install only the first Invocation of an
instance logs the missing autoloader on stdout, the next ones log the
missing Handler class on stderr. An unmet platform requirement fails
the install the same way. Add the platform advice and a smoke check.
Jérémy DECOOL committed 2026-11-14T15:58:32+01:00 Browse files
46aa06f parent: fdc6e0c
modified README.md +8 -2
@@ -523,13 +523,19 @@ Headers whose name holds an underscore (`X_Real_Ip`) are dropped, as nginx and A
523523
524524 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/`.
525525 Every locked package must therefore be downloadable from Scaleway, and the function's environment variables are not available to Composer scripts.
526+The lock must also install on the function's runtime: set `config.platform.php` in `composer.json` to its PHP version (`8.4` for `php84`, `8.5` for `php85`) so that `composer update` resolves for it.
526527 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)):
527528
528529 - 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+- a failing install, from a package Scaleway cannot download or a platform requirement its runtime does not meet, leaves no `vendor/` at all: every Invocation answers a `500`, the first one of each instance logging `Failed to open stream` for `vendor/autoload.php` on stdout, the next ones `Class "JDecool\ScalewayRuntime\Handler" not found` on stderr.
530531
531532 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+So after each deploy, call a route that should answer a `200`, and check the function's [logs](#logs) if it does not:
534+
535+```sh
536+curl -sS -o /dev/null -w '%{http_code}\n' "https://$(scw function function list name=<function name> -o json | jq -r '.[0].domain_name')/<route>"
537+```
538+
533539 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.
534540
535541 ### Windows
@@ -523,13 +523,19 @@ 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+The lock must also install on the function's runtime: set `config.platform.php` in `composer.json` to its PHP version (`8.4` for `php84`, `8.5` for `php85`) so that `composer update` resolves for it.
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 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
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 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+- a failing install, from a package Scaleway cannot download or a platform requirement its runtime does not meet, leaves no `vendor/` at all: every Invocation answers a `500`, the first one of each instance logging `Failed to open stream` for `vendor/autoload.php` on stdout, the next ones `Class "JDecool\ScalewayRuntime\Handler" not found` on stderr.
530 531
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 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+So after each deploy, call a route that should answer a `200`, and check the function's [logs](#logs) if it does not:
534+
535+```sh
536+curl -sS -o /dev/null -w '%{http_code}\n' "https://$(scw function function list name=<function name> -o json | jq -r '.[0].domain_name')/<route>"
537+```
538+
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.539 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.
534 540
535 ### Windows541 ### Windows
modified docs/probe-results.md +3 -0
@@ -34,11 +34,14 @@ Measured on 2026-11-14 on `php85` with a scratch function requiring `psr/log`, w
3434 | `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 |
3535 | `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 |
3636 | `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+| In a second run of `v1` to `v3`, a zip over `v3` whose lock requires an extension no runtime loads (`ext-review-absent`, ignored by the local `composer update`) | `ready`, `error_message` and `build_message` null | The new code, without any `vendor/` nor marker, as a platform requirement the runtime does not meet fails the install too |
38+| A Symfony application requiring `jdecool/scaleway-runtime` `v0.1.0` from Packagist, its `handler.php` written by `scaleway-init`, first deployed working, then with an extra locked package whose dist URL does not resolve | `ready`, `error_message` and `build_message` null | Every Invocation a `500`: the first one of the instance `Error 500: Internal Server Error`, logging the `Failed to open stream` warning above on stdout, the next ones `Error while executing function`, logging `Class "JDecool\ScalewayRuntime\Handler" not found` on stderr |
3739
3840 - A deployment always serves the new zip: Scaleway never keeps the previous version, whatever Composer does.
3941 - `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.
4042 - A failing install leaves no `vendor/` at all, Composer downloading every package before installing any.
4143 The runtime's `Handler` being in `vendor/`, every Invocation of an application then fails.
44+- The `php85` runtime loads 121 extensions, `intl`, `gd`, `redis`, `amqp`, `mongodb`, `pdo_pgsql` and `pdo_mysql` included, so an unmet platform requirement is more likely the PHP version of a lock resolved for another one.
4245 - 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.
4346 - 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.
4447
@@ -34,11 +34,14 @@ Measured on 2026-11-14 on `php85` with a scratch function requiring `psr/log`, w
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 |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 |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/` |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+| In a second run of `v1` to `v3`, a zip over `v3` whose lock requires an extension no runtime loads (`ext-review-absent`, ignored by the local `composer update`) | `ready`, `error_message` and `build_message` null | The new code, without any `vendor/` nor marker, as a platform requirement the runtime does not meet fails the install too |
38+| A Symfony application requiring `jdecool/scaleway-runtime` `v0.1.0` from Packagist, its `handler.php` written by `scaleway-init`, first deployed working, then with an extra locked package whose dist URL does not resolve | `ready`, `error_message` and `build_message` null | Every Invocation a `500`: the first one of the instance `Error 500: Internal Server Error`, logging the `Failed to open stream` warning above on stdout, the next ones `Error while executing function`, logging `Class "JDecool\ScalewayRuntime\Handler" not found` on stderr |
37 39
38 - A deployment always serves the new zip: Scaleway never keeps the previous version, whatever Composer does.40 - 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.41 - `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.42 - 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.43 The runtime's `Handler` being in `vendor/`, every Invocation of an application then fails.
44+- The `php85` runtime loads 121 extensions, `intl`, `gd`, `redis`, `amqp`, `mongodb`, `pdo_pgsql` and `pdo_mysql` included, so an unmet platform requirement is more likely the PHP version of a lock resolved for another one.
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.45 - 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.46 - 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 47