Error: Class "Patreon\OAuth" not found

Created on 5 April 2023, about 1 year ago
Updated 6 April 2023, about 1 year ago

I keep getting the:

Error: Class "Patreon\OAuth" not found in Drupal\patreon\PatreonService->getOauth() (line 307 of /var/www/html/web/modules/contrib/patreon/src/PatreonService.php) 

when I try to save the Patreon module setting with the key and the secret.
I already ran the composer install inside the module and also tried installing the patreon-php library from the site's root.
Any idea what am I missing?

Thanks!

πŸ› Bug report
Status

Closed: cannot reproduce

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jvanja

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jvanja
  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    It sounds like you haven't installed the module using Drupal's composer integration: composer require drupal/patreon being run in the root of your Drupal install. Would that be the case?

    I suspect that you've manually put the module in modules/contrib and then run the composer install there, which won't put the required patreon library in the right place for Drupal's autoload to discover it, causing the error you've seen.

    If that's not the case, can you give me the steps to recreate the error, starting with downloading the module and going from there?

  • πŸ‡ΊπŸ‡ΈUnited States jvanja

    Thanks for the quick response MrDaleSmith.
    So I did install the module via composer by running the 'composer require drupal/patreon' from the site's root.
    The below tells me everything should be installed correctly:

    Lock file operations: 2 installs, 0 updates, 0 removals
      - Locking drupal/patreon (4.0.0)
      - Locking patreon/patreon (1.0.0)

    Afterward, I registered the app on the Patreon site to get the key and the secret and put https://MYSITE/patreon/oauth as the endpoint.
    Then, I put the key and the secret in admin/config/services/patreon/settings.
    Finally, I pressed "Save Configuration" which brings the Patreon permissions page where I just click "Allow" and it redirects me to the endpoint above with 2 query params 'code' and 'state'.
    The /patreon/oauth page returns as 404 and I see the error in the Drupal logs.

    The same happens on 2 two separate sites I am running with Drupal Version 9.5.7 PHP 8.1.14.
    Not sure it matters, but the composer version is 2.5.5

    Thanks for your help!

  • Status changed to Closed: cannot reproduce about 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    I may be quick, but I don't think I can help: I've just tested composer require drupal/patreon on a clean Drupal 9.5.7, PHP 8.1.16 installation using composer 2.5.5 and had no problems with it.

    I can't think of what could be going wrong: the Patreon API will throw an error is the URL you send it to redirect to doesn't match the one in the client set up on their side, so if you're getting redirected back to your site that should all be correct. It sounds like the cause of your issue is with the autoload functionality that Drupal/composer use to ensure all libraries downloaded through composer are available to Drupal, but the issue appears to be specific to your set up. Have you tried testing locally with ddev or similar to see if you can find the source of the problem?

    The only other thing that occurs to me is that the /oauth route is only available to users with the 'administer patreon' permission, but that wouldn't return a 404 or log a missing library issue.

    I'm afraid I can't confirm this is an issue with the module, so I'm going to close as won't reproduce. If you find differently, please do reopen and I'll investigate further.

Production build 0.69.0 2024