phplaravelgoogle-app-enginecomposer-php

laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] on google app engine standard php81 deployment


When trying to deploy a Laravel 10 application to a Google Cloud app engine standard environment running php 8.1 the following error occurs:

screenshot of image in console

Is there a way to update the google cloud app engine composer-runtime-api when running a standard environment?

I've checked the docs but there is no mentioning of the composer version or composer-runtime-api versions running on standard environments or any description on how to change these.

I've already tried to add composer-runtime-api ^2.2 as a dependency but that resulted in the same error being shown on deployment.

Here is the relevant part of the build log from Google Cloud:

===> BUILDING
=== PHP - Runtime (google.php.runtime@0.0.2) ===
Using runtime version from GOOGLE_RUNTIME_VERSION: 8.1.17
DEBUG: ***** CACHE MISS: "php"
Installing PHP Runtime v8.1.17.
2023/04/29 13:55:22 [DEBUG] GET https://dl.google.com/runtimes/ubuntu1804/php/php-8.1.17.tar.gz
Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
=== PHP - Composer Install (google.php.composer-install@0.0.1) ===
DEBUG: ***** CACHE MISS: "composer"
2023/04/29 13:55:27 [DEBUG] GET https://getcomposer.org/installer
2023/04/29 13:55:27 [DEBUG] GET https://composer.github.io/installer.sig
--------------------------------------------------------------------------------
Running "bash -c php -d 'error_reporting=24575' -r \"echo hash_file('sha384', '/layers/google.php.composer-install/composer/composer-setup-2629473669.php');\""
xxxx "bash -c php -d 'error_reporting=24575' -r \"echo hash_file('s..." (425.829387ms)
installing Composer v2.1.3
--------------------------------------------------------------------------------
Running "bash -c php /layers/google.php.composer-install/composer/composer-setup-2629473669.php --install-dir /layers/google.php.composer-install/composer/bin --filename composer --version 2.1.3"
All settings correct for using Composer
Downloading...

Composer (version 2.1.3) successfully installed to: /layers/google.php.composer-install/composer/bin/composer
Use it: php /layers/google.php.composer-install/composer/bin/composer

Done "bash -c php /layers/google.php.composer-install/composer/com..." (258.279492ms)
Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
=== PHP - Composer (google.php.composer@0.9.1) ===
--------------------------------------------------------------------------------
Running "php -r echo PHP_VERSION;"
8.1.17Done "php -r echo PHP_VERSION;" (17.67139ms)
DEBUG: Current dependency hash: "xxxx"
DEBUG:   Cache dependency hash: ""
DEBUG: ***** CACHE MISS: "prod dependencies"
DEBUG: No metadata found from a previous build, skipping cache.
Installing application dependencies.
--------------------------------------------------------------------------------
Running "composer install --no-dev --no-progress --no-interaction --optimize-autoloader"

Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/Repository/ArrayRepository.php:286
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Deprecation Notice: Return type of Composer\DependencyResolver\Pool::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Pool.php:82
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSet.php:119
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSet.php:101
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:155
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:165
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:160
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:170
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:150
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:145
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:36
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:46
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:41
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:89
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:70
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - laravel/framework is locked to version v10.9.0 and an update of this package was not requested.
    - laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint.
  Problem 2
    - laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint.
    - spatie/laravel-permission 5.10.1 requires illuminate/auth ^7.0|^8.0|^9.0|^10.0 -> satisfiable by laravel/framework[v10.9.0].
    - spatie/laravel-permission is locked to version 5.10.1 and an update of this package was not requested.

Done "composer install --no-dev --no-progress --no-interaction --o..." (523.780904ms)
Failure: (ID: 8fe845e7) ...google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:150
Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:145
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:36
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:46
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:41
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:89
Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:70
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - laravel/framework is locked to version v10.9.0 and an update of this package was not requested.
    - laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint.
  Problem 2
    - laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint.
    - spatie/laravel-permission 5.10.1 requires illuminate/auth ^7.0|^8.0|^9.0|^10.0 -> satisfiable by laravel/framework[v10.9.0].
    - spatie/laravel-permission is locked to version 5.10.1 and an update of this package was not requested.
--------------------------------------------------------------------------------
Running "mv -f /builder/outputs/output-1561546128934258592 /builder/outputs/output"
Done "mv -f /builder/outputs/output-1561546128934258592 /builder/o..." (16.23967ms)
ERROR: failed to build: exit status 1

In my app.yaml i've only set the runtime like so:

runtime: php81

and some other irrelevant handlers and environment variables.


Solution

  • Google provided an answer on their IssueTracker saying you can specify:

    build_env_variables:
      GOOGLE_COMPOSER_VERSION: 2.2.1
    

    In the app.yaml now to override the composer version on the GAE service.

    Not tested yet.

    Edit: Tested but not working, updated Google Cloud SDK on local machine to latest version (435.0.1) as suggested by the Google team but that did not work. Will post a solution as soon as found.

    Edit 2:

    Testen and working now when using composer version 2.5.8. Unclear whether the failure of version 2.2.1 is a bug, but i'm able to deploy Laravel 10 to an App Engine standard environment using the configuration below in the app.yaml.

    build_env_variables:
      GOOGLE_COMPOSER_VERSION: 2.5.8