Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Call to undefined function GuzzleHttp\Psr7\uri_for() #1

Open
longmtran opened this issue Jan 14, 2019 · 3 comments
Open

Error Call to undefined function GuzzleHttp\Psr7\uri_for() #1

longmtran opened this issue Jan 14, 2019 · 3 comments

Comments

@longmtran
Copy link

longmtran commented Jan 14, 2019

Steps followed:

  1. composer require nickwilde1990/drupal-spec-tool-commands
  2. Add "drupal-spec-tools" section to composer.json
  3. Generate Google API key file and update spreadsheet ID in composer.json
  4. Run: composer drupal-spec-dump-gherkin but hit undefined function error:
Fatal error: Uncaught Error: Call to undefined function GuzzleHttp\Psr7\uri_for() in /private/var/www/example-site/vendor/google/auth/src/OAuth2.php:1284
Stack trace:
#0 /private/var/www/example-site/vendor/google/auth/src/OAuth2.php(681): Google\Auth\OAuth2->coerceUri('https://account...')
#1 /private/var/www/example-site/vendor/google/auth/src/OAuth2.php(334): Google\Auth\OAuth2->setAuthorizationUri('https://account...')
#2 /private/var/www/example-site/vendor/google/apiclient/src/Google/Client.php(952): Google\Auth\OAuth2->__construct(Array)
#3 /private/var/www/example-site/vendor/google/apiclient/src/Google/Client.php(932): Google_Client->createOAuth2Service()
#4 /private/var/www/example-site/vendor/google/apiclient/src/Google/Client.php(337): Google_Client->getOAuth2Service()
#5 /private/var/www/example-site/vendor/nickwilde1990/drupal-spec-tool-commands/src/GoogleSpreadsheetAccessTrait.php(38): Google_Client->createAuthUrl()
#6 /private/var/www/example-site/vendor/nickwilde1990/drupal-spec-tool-commands/src/Command/DrupalSpecGherkinDumper. in /private/var/www/example-site/vendor/google/auth/src/OAuth2.php on line 1284

This site is installed with Acquia BLT and Acquia Lightning profile.

@ethanteague
Copy link

Same issue as above. I did try pulling in google dependencies from your composer.json, and autoloading namespaces defined in your composer.json, but same result.

@tgifford-webfirst
Copy link

Composer version: 1.10.8
drupal-spec-tool-commands: v1.0.0-rc1

Not sure why autoloading isn't working, but it seems to only be a problem for functions outside classes. This terrible hackpatch gets it working:

--- vendor/nickwilde1990/drupal-spec-tool-commands/src/ComposerPlugin.php.bak	2020-07-10 23:54:26.411037775 -0400
+++ vendor/nickwilde1990/drupal-spec-tool-commands/src/ComposerPlugin.php	2020-07-10 23:54:20.678567881 -0400
@@ -25,6 +25,9 @@
    */
   public function activate(Composer $composer, IOInterface $io)
   {
+    include __DIR__ . '/../../../guzzlehttp/psr7/src/functions_include.php';
+    include __DIR__ . '/../../../guzzlehttp/guzzle/src/functions_include.php';
+    include __DIR__ . '/../../../guzzlehttp/promises/src/functions_include.php';
   }
 
   public function getCapabilities()

@esod
Copy link

esod commented Jan 5, 2021

Composer version 1.10.15
drupal-spec-tool-commands: v1.0.0-rc1

I confirm that @tgifford-webfirst's patch solved the same problem for me. Thanks.

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

No branches or pull requests

4 participants