Skip to content
Advertisement

Sentry Transport errors

I’m trying to implement Sentry in our application.

I’ve used sentry/sdk but got some errors (probably due to some PHP settings), so I’m now trying to switch the transport method.

I removed sentry/sdk from my composer.json file and replaced it with sentry/sentry and php-http/guzzle7-adapter. Please note that in the documentation, they use the guzzle6-adapter, but that gave dependency errors (I was already using "guzzlehttp/guzzle": "^7.3", so I need to use version 7).

When now trying to initialize Sentry, I get the following error:

Fatal error: Uncaught HttpDiscoveryExceptionDiscoveryFailedException: 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 "HttpDiscoveryStrategyCommonClassesStrategy". We tested the following candidates: . - No valid candidate found using strategy "HttpDiscoveryStrategyCommonPsr17ClassesStrategy". We tested the following candidates: PhalconHttpMessageStreamFactory, NyholmPsr7FactoryPsr17Factory, ZendDiactorosStreamFactory, GuzzleHttpPsr7HttpFactory, HttpFactoryDiactorosStreamFactory, HttpFactoryGuzzleStreamFactory, HttpFactorySlimStreamFactory, LaminasDiactorosStreamFactory, SlimPsr7FactoryStreamFactory. in vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php:41

It is a custom application, so I cannot use e.g. the Sentry Laravel package.

Advertisement

Answer

The docs are incorrect at the moment and reference the old dependencies required.

In case that you want to use Guzzle the following should work:

composer require sentry/sentry guzzlehttp/guzzle http-interop/http-factory-guzzle

This recreates the current SDK metapackage dependencies:

    "require": {
        "sentry/sentry": "^3.1",
        "http-interop/http-factory-guzzle": "^1.0",
        "symfony/http-client": "^4.3|^5.0"
    },

Except that symfony/http-client was replaced by guzzlehttp/guzzle.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement