sentry-symfony: Crash on install: missing nyholm/psr7 depencency
I did a a setup of your bundle following the documentation provided by the user interface:
composer require sentry/sentry-symfony
Then my project crash with the following error:
Symfony\Component\Debug\Exception\ClassNotFoundException:
Attempted to load class "Psr17Factory" from namespace "Nyholm\Psr7\Factory".
Did you forget a "use" statement for another namespace?
at var/cache/dev/ContainerHgJCfth/getDebug_SensioFrameworkExtra_Psr7_ArgumentValueResolver_ServerRequestService.php:9
at require()
(var/cache/dev/ContainerHgJCfth/srcApp_KernelDevDebugContainer.php:877)
at ContainerHgJCfth\srcApp_KernelDevDebugContainer->load('getDebug_SensioFrameworkExtra_Psr7_ArgumentValueResolver_ServerRequestService.php')
(var/cache/dev/ContainerHgJCfth/srcApp_KernelDevDebugContainer.php:1851)
at ContainerHgJCfth\srcApp_KernelDevDebugContainer->ContainerHgJCfth\{closure}()
(vendor/php/symfony/http-kernel/Controller/ArgumentResolver.php:51)
at Symfony\Component\HttpKernel\Controller\ArgumentResolver->getArguments(object(Request), array(object(HostingController), 'indexAction'))
(vendor/php/symfony/http-kernel/Controller/TraceableArgumentResolver.php:38)
at Symfony\Component\HttpKernel\Controller\TraceableArgumentResolver->getArguments(object(Request), array(object(HostingController), 'indexAction'))
(vendor/php/symfony/http-kernel/HttpKernel.php:150)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/php/symfony/http-kernel/HttpKernel.php:80)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/php/symfony/http-kernel/Kernel.php:201)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(public/index.php:34)
I solved the issue just by adding the right package:
composer require nyholm/psr7
You may have to fix your dependencies definition.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (3 by maintainers)
It could be nice to add in the UPGRADE note to add
Unfortunately, I live in France, not in Theory. I wish I could go there. š
Here it is:
Yes I know. Quite a lot of dependencies.
Even if itās not related to this bundle, Itās about helping the users to upgrade. I took 1 hour to solve this issue. One hour which could be saved with two lines in the Upgrade doc. Do you like your users and wants to help them or not ? š
Maybe just an extra note? The PSR-7 bit seems to be going away in a forthcoming 6.0 release, but until thatās released this is just an extra thing folks have to keep in mind.
āIf you have
SensioFrameworkExtraBundle< 6.0 installed and are not using its PSR-7 feature, you will need to disable it in your applicationās configuration or there will most likely be a crash due to missing dependencies, you can fix this by adding this to the bundleās configuration:ā (then the snippet posted in https://github.com/getsentry/sentry-symfony/issues/379#issuecomment-768184584 goes here).TBH, the error itself isnāt all that bad and I donāt think anyoneās intent is to play the blame game on whoās wrong; I actually am more surprised the Sensio bundle had that feature enabled by default than the fact I got an error related to that after upgrading the Sentry bundle.
@ste93cry Thanks.
In case somebody else stumbles upon this issue the situation is described here and a workaround is provided as well.
Looking at the stacktrace, the issue is related to the
SensioFrameworkExtraBundlebundlehttps://github.com/sensiolabs/SensioFrameworkExtraBundle/pull/710
For me, the solution was just to delete
psr_http_message_bridge.yaml, which some stupid flex recipe thing had produced for no good reason, breaking my application referencing non-existent services.