Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

PHP Fatal error: Uncaught Http\Discovery\Exception\DiscoveryFailedException: Could not find resource using any discovery strategy #79

Open
aaronpk opened this issue Apr 2, 2021 · 5 comments

Comments

@aaronpk
Copy link
Contributor

aaronpk commented Apr 2, 2021

In a brand new install of this library, I am getting the following error:

PHP Fatal error:  Uncaught Http\Discovery\Exception\DiscoveryFailedException: 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: Phalcon\Http\Message\ResponseFactory, Nyholm\Psr7\Factory\Psr17Factory, Zend\Diactoros\ResponseFactory, GuzzleHttp\Psr7\HttpFactory, Http\Factory\Diactoros\ResponseFactory, Http\Factory\Guzzle\ResponseFactory, Http\Factory\Slim\ResponseFactory, Laminas\Diactoros\ResponseFactory, Slim\Psr7\Factory\ResponseFactory.

In an empty folder, I ran:

composer require okta/jwt-verifier firebase/php-jwt guzzlehttp/psr7

Then created a file test.php containing:

<?php
require('vendor/autoload.php');

$jwtVerifier = (new \Okta\JwtVerifier\JwtVerifierBuilder())
    ->setIssuer('foo')
    ->setAudience('api://default')
    ->setClientId('foo')
    ->setAdaptor(new \Okta\JwtVerifier\Adaptors\FirebasePhpJwt())
    ->build();

When running php test.php I get the above error. I tried installing the mentioned libraries at the link in the error:

composer require php-http/curl-client guzzlehttp/psr7 php-http/message

but still get the same errors.

I am running PHP 7.4.16

@bryanapellanes-okta
Copy link

@aaronpk,
Thanks for bringing this to our attention! I've added an item to our backlog for prioritization; our PHP developers will review and comment here when there's more to share.

@serhiibuniak-okta
Copy link

@aaronpk To unblock you I can suggest installing the following libraries:

composer require mailgun/mailgun-php kriswallsmith/buzz nyholm/psr7

Please, let us know if it works for you. Meanwhile, we'll investigate what might be wrong.

@aaronpk
Copy link
Contributor Author

aaronpk commented Apr 7, 2021

Thank you, adding these libraries works and that's enough to finish updating the blog post for now!

@jimkropa
Copy link

Same problem and workaround for me, PHP 7.4.20

@jimkropa
Copy link

Was also able to replicate the problem and workaround on a different machine running PHP 7.2.34

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants