php-runtime / runtime

A home for runtimes.
MIT License
404 stars 32 forks source link

Problems integrating Functions when PHP74 is not preview anymore #85

Open petr-ekl-itcube opened 3 years ago

petr-ekl-itcube commented 3 years ago

Hi Tobias.

We are developing with Symfony and Google Functions. It's fresh so there are changes probably. Today we are facing some bad news.

We have problem from today as Coposer 1 run by deploy script from google forces to install their own router and crashes on it.

When I do it myself before, there starts to be conflict and google in autoload and router is invoked as the first so your library is out of work.

Maybe we are not the only one or we deploy differently. Do you have any suggestions?

Is there any way to share knowledge around your project than mailing you?

-------------------- Not installing Google's router:

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/ Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/ ./composer.json has been updated Loading composer repositories with package information Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/ Updating dependencies (including require-dev) Restricting packages listed in "symfony/symfony" to "5.3.*" Your requirements could not be resolved to an installable set of packages.

Problem 1

Installation failed, reverting ./composer.json to its original content.; Error ID: caafae72

-------------- Installing Google's router

Nothing to install, update or remove Generating optimized autoload files Warning: Ambiguous class resolution, "Google\CloudFunctions\CloudEvent" was found 2x: in "D:/www/cg-platby-test/app/vendor/google/cloud-functions-framework/src/CloudEvent.php" and "D:/ww w/cg-platby-test/app/vendor/runtime/google-cloud/google\CloudEvent.php", the first will be used. Warning: Ambiguous class resolution, "Google\CloudFunctions\Context" was found 2x: in "D:/www/cg-platby-test/app/vendor/google/cloud-functions-framework/src/Context.php" and "D:/www/cg-p latby-test/app/vendor/runtime/google-cloud/google\Context.php", the first will be used. Warning: Ambiguous class resolution, "Google\CloudFunctions\LegacyEventMapper" was found 2x: in "D:/www/cg-platby-test/app/vendor/google/cloud-functions-framework/src/LegacyEventMapper.p hp" and "D:/www/cg-platby-test/app/vendor/runtime/google-cloud/google\LegacyEventMapper.php", the first will be used. 37 packages you are using are looking for funding. Use the composer fund command to find out more!

--------------- and then deployed:

*5 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught InvalidArgumentException: Function target is not callable: "throwException" in /workspace/vendor/google/cloud-functions-framework/router.php:68 Stack trace:

0 /workspace/vendor/google/cloud-functions-framework/router.php(77): {closure}()

alexander-schranz commented 3 years ago

I deployed today a Basic Symfony Application with the Google Cloud Runtime and it did work for me. https://github.com/alexander-schranz/runtime-example-application

Maybe there where changes on the google side which did fix it, can you confirm that it works also for you again?

Keep in mind that google cloud does not yet have support for PHP 8, so you should have a composer.lock which was generated with PHP 7.4 in your project directory, else I did in my case also get an error as I had some PHP 8 package first in my composer lock which I needed to downgrade.