sentry-laravel: Can't install Sentry - Composer error

Hi,

I can’t install the package through composer.

Here is the error:

  Problem 1
    - Installation request for sentry/sentry-laravel ^1.0 -> satisfiable by sentry/sentry-laravel[1.0.0, 1.0.0-beta1, 1.0.0-beta2, 1.0.0-beta3, 1.0.0-beta4, 1.0.0-beta5, 1.0.1, 1.0.x-dev].
    - Can only install one of: php-http/httplug[v2.0.0, v1.1.0].
    - Can only install one of: php-http/httplug[v1.1.0, v2.0.0].
    - Can only install one of: php-http/httplug[v1.1.0, v2.0.0].
    - Conclusion: install php-http/httplug v1.1.0
    - Installation request for php-http/httplug (locked at v2.0.0) -> satisfiable by php-http/httplug[v2.0.0].

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 32 (6 by maintainers)

Most upvoted comments

So it looks like there is some sort of incompatibility that composer for some reason is not complaining about (that we believe should be happening).

The problem is that you guys are using laravel/passport that requires zendframework/zend-diactoros:^1.0 but also requiring the php-http/curl-client:^2.0 (directly or indirectly) which requires zendframework/zend-diactoros:^2.0 (or another package that implements the PSR-17 response factory).

There are 2 solutions.

  • Upgrade laravel/passport to ^7.2.2 which allows for the correct zendframework/zend-diactoros:^2.0 to be installed
  • Downgrade/install php-http/curl-client:^1.0

We are seeing if there is something we can do from our side or we might be doing it wrong or there is a problem in the dependencies of httplug, but the above solutions should get you moving with using sentry/sentry-laravel:^1.0.

@stayallive thanks for looking into this, it’s really appreciated when product teams look out for their community, getting more rare these days with early dismissal of “not our problem”.

Tomorrow I’ll try upgrading passport - this seems to make the most logical and progressive sense and shall report back 😃

Update

Updating passport did solve it 😃 running laravel/passport 7.2.2

Although upgrading passport caused a strange mixture of errors and api endpoints not being authenticated properly so spend whole bunch of time fixing that 😦

@stayallive We’re also experiencing this - have tried a rm -rf vendor with a full composer update/install combo.

This is all our packages

 "require": {
        "php": "^7.1.3",
        "ext-json": "*",
        "algolia/algoliasearch-client-php": "^1.25",
        "backpack/crud": "^3.4",
        "backpack/logmanager": "^2.3",
        "backpack/permissionmanager": "^2.1",
        "chelout/laravel-relationship-events": "^1.0",
        "danielstjules/stringy": "^3.1",
        "fideloper/proxy": "^4.0",
        "genealabs/laravel-model-caching": "^0.4",
        "guzzlehttp/guzzle": "^6.3",
        "jgrossi/corcel": "^2.8",
        "jrean/laravel-user-verification": "^7.0",
        "laravel/framework": "5.8.*",
        "laravel/horizon": "^1.2",
        "laravel/passport": "^6.0",
        "laravel/scout": "^4.0",
        "laravel/socialite": "^4.0",
        "laravel/tinker": "^1.0",
        "league/csv": "^8.0",
        "mihaeu/html-formatter": "^1.0",
        "owen-it/laravel-auditing": "^9.0",
        "owenmelbz/domain-enforcement": "^0.0.6",
        "owenmelbz/laravel-stubs": "^0.0.5",
        "owenmelbz/vue-impersonate": "^0.0.5",
        "paragonie/csp-builder": "^2.3",
        "phpoffice/phpspreadsheet": "^1.6",
        "pragmarx/firewall": "^2.2",
        "predis/predis": "^1.1",
        "schuppo/password-strength": "^1.11",
        "sentry/sentry-laravel": "^1.0",
        "squizlabs/php_codesniffer": "^3.2",
        "symfony/css-selector": "^4.1",
        "symfony/dom-crawler": "^4.0",
        "tightenco/ziggy": "^0.6.6",
        "unicodeveloper/laravel-password": "^1.0",
        "whichbrowser/parser": "^2.0",
        "worldpay/worldpay-lib-php": "^2.1",
        "yadahan/laravel-authentication-log": "^1.2"
    },

These are the sentry packages that have got installed

laravel/framework                     v5.8.7             The Laravel Framework.
sentry/sdk                            2.0.2              This is a metapackage shipping sentry/sentry with a recommended http...
sentry/sentry                         2.0.1              A PHP SDK for Sentry (http://sentry.io)
sentry/sentry-laravel                 1.0.1              Laravel SDK for Sentry (https://sentry.io)

Getting the same No PSR-17 response factory found error

Please share your composer.json if possible so we can investigate why a suitable transport cannot be found.

I believe that the reason (if he did what @Jean85 suggested) is that by telling Composer to not install sentry/sdk (the metapackage) then obviously each dependency of the core package must be required manually, which means a HTTP transport compatible with HTTPlug and a PSR-7 package

Yeah, Fixed my issue with a note on the docs at the very last section. @stayallive Good job on the doc update

image

@stayallive This happening when I update composer. Any thoughts?

image

λ composer require sentry/sentry-laravel
Using version ^1.0 for sentry/sentry-laravel
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

In ClassDiscovery.php line 210:

  Unexpected exception when instantiating class.


In Psr17FactoryDiscovery.php line 22:

  No PSR-17 response factory found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation


In DiscoveryFailedException.php line 41:

  Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors
   - Puli Factory is not available
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonClassesStrategy". We tested the following candidates: .
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonPsr17ClassesStrategy". We tested the following candidates: Nyholm\Psr7\Factory\Psr17Factory, Zend\Diactoros\ResponseFactory, Http\Factory\Diactoros\ResponseFacto
  ry, Http\Factory\Guzzle\ResponseFactory, Http\Factory\Slim\ResponseFactory.


ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan ide-helper:generate

In ClassDiscovery.php line 210:

  Unexpected exception when instantiating class.


In Psr17FactoryDiscovery.php line 22:

  No PSR-17 response factory found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation


In DiscoveryFailedException.php line 41:

  Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors
   - Puli Factory is not available
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonClassesStrategy". We tested the following candidates: .
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonPsr17ClassesStrategy". We tested the following candidates: Nyholm\Psr7\Factory\Psr17Factory, Zend\Diactoros\ResponseFactory, Http\Factory\Diactoros\ResponseFacto
  ry, Http\Factory\Guzzle\ResponseFactory, Http\Factory\Slim\ResponseFactory.


> php artisan ide-helper:meta

In ClassDiscovery.php line 210:

  Unexpected exception when instantiating class.


In Psr17FactoryDiscovery.php line 22:

  No PSR-17 response factory found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation


In DiscoveryFailedException.php line 41:

  Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors
   - Puli Factory is not available
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonClassesStrategy". We tested the following candidates: .
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonPsr17ClassesStrategy". We tested the following candidates: Nyholm\Psr7\Factory\Psr17Factory, Zend\Diactoros\ResponseFactory, Http\Factory\Diactoros\ResponseFacto
  ry, Http\Factory\Guzzle\ResponseFactory, Http\Factory\Slim\ResponseFactory.

I suggested https://github.com/getsentry/sentry-php-sdk/pull/2 as a solution, so you can try to apply it indipendently requiring http-interop/http-factory-guzzle. In general, requiring any of the feasible package would fix the issue, since sentry/sdk is only used to require the suggested transport, but you’re not forced to use those.

@adamcopley try running composer update first, we recently updated our dependencies to allow for the 2.0 of the httplug CURL client and I just tried your dependencies and they install correctly without issues.

@Otienoh I have no idea what you have in your composer.json, if you could post that it would help figuring it out. But just the following is enough to get a working setup (default Laravel packages + sentry/sentry-laravel).

    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0",
        "sentry/sentry-laravel": "^1.0"
    },