500 Error when authenticating with Google [Calendar app]

I followed the instructions in the documentation here:

and set up the app on Google dev console etc. The went to advanced in the user profile but on the last step after that authentication screen it ends up with a 500 error:
/index.php?entryPoint=saveGoogleApiKey&code=4/0AxFgS334Deeu4cmXg-OFFF45TZYKF_PX8SmUerfefw3F543t43fdD5445fDdsVmNtGe9jQ&scope=https://www.googleapis.com/auth/calendar

Any ideas? :thinking:

Kind regards
PowerQuest

Hi @PowerQuest,

Can you go back to this step and ensure the redirect URLs are correct/point to the correct accessible pathing with your CRM instance?

Noting that: “Authorized JavaScript origins” should contain the bog standard URL to your CRM without index.php or anything extra

“Authorized redirect URIs” being the above bog standard URL with the following appended;
/index.php?entryPoint=saveGoogleApiKey

(Side note, mine currently has &getnew on the end of saveGoogleApiKey, maybe give that a go also)

Thanks for the reply @Mac-Rae

We do not run SuiteCRM from a subdirectory and our configuration looks like this at Google:

So it seems to be correct, but we still get the 500 internal server error when attempting to access the service and authenticate with google (the consent screen). It crashes directly after you click ok to go a ahead…

Kind regards
PowerQuest

Hey! You’ll need to add an Authorised JavaScript origins anyways, just with your base URL.

Oh ok, so that is what is missing?

Thanks, I’ll add it and test it out. :+1:

Kind regards
PowerQuest

Hello @Mac-Rae

Hmm that failed, not sure why.

Error message:

Here is the configuration in the Google Dev console:
image

Suitecrm.log is pretty clean and doesn’t menation a word about Google:

(
)

Fri Apr 29 13:01:27 2022 [12501][8b3ba8d1-f0e7-a0be-2dbf-5e3328ef8b86][DEPRECATED] Array
(
)

Fri Apr 29 15:02:08 2022 [12834][8b3ba8d1-f0e7-a0be-2dbf-5e3328ef8b86][DEPRECATED] Array
(
)

Fri Apr 29 15:02:08 2022 [12836][8b3ba8d1-f0e7-a0be-2dbf-5e3328ef8b86][DEPRECATED] Array
(
)

Fri Apr 29 15:02:08 2022 [12837][8b3ba8d1-f0e7-a0be-2dbf-5e3328ef8b86][DEPRECATED] Array
(
)

Fri Apr 29 15:02:08 2022 [12838][8b3ba8d1-f0e7-a0be-2dbf-5e3328ef8b86][DEPRECATED] Array
(
)

Fri Apr 29 15:03:08 2022 [13376][8b3ba8d1-f0e7-a0be-2dbf-5e3328ef8b86][DEPRECATED] Array
(

Not sure what it references to in regard to the array is deprecated?

Error. log however is full of references to some google service:

[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Model' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Collection' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Service' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Service_Resource' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Model' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Collection' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Service' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Service_Resource' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Model' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Collection' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Service' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Service_Resource' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Model' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 21
[29-Apr-2022 15:08:08 Europe/London] PHP Warning:  Class 'Google_Collection' not found in /public_html/vendor/google/apiclient-services/autoload.php on line 2

Thoughts? :thinking:

Thanks in advance

Kind regards
PowerQuest

Anyone that have this issue too or have maybe an idea of what is going on here?

I’d appreciate very much any help that might lead me to a solution of this.

Kind regards
PowerQuest

I’m having the exact same issue +1

I would run some tests on the PHP version - check if the problem only happens with PHP 8, but not 7.x.

If it’s PHP 8 only, then look for FATALs in php_errors.log, even if they look unrelated to any Google code.

Not sure what @PowerQuest is running, I’m running PHP 7.4.

Same as you for now. :wink:

Kind regards
PowerQuest

If there is a 500 error, there really should be a Fatal error in the php_errors.log

Pay attention to the timestamps in the logs, see what happens exactly at the time of the attempt.

I get the same errors:

[05-May-2022 13:55:01 UTC] PHP Warning:  Class 'Google_Service' not found in /home/MYCRMURL/vendor/google/apiclient-services/autoload.php on line 21
[05-May-2022 13:55:01 UTC] PHP Warning:  Class 'Google_Service_Resource' not found in /home/MYCRMURL/vendor/google/apiclient-services/autoload.php on line 21
[05-May-2022 13:55:01 UTC] PHP Warning:  Class 'Google_Model' not found in /home/MYCRMURL/vendor/google/apiclient-services/autoload.php on line 21
[05-May-2022 13:55:01 UTC] PHP Warning:  Class 'Google_Collection' not found in /home/MYCRMURL/vendor/google/apiclient-services/autoload.php on line 21
[05-May-2022 13:55:01 UTC] PHP Warning:  include(custom/metadata/free_frelance_contracts_free_frelance_contractsMetaData.php): failed to open stream: No such file or directory in /home/MYCRMURL/custom/application/Ext/TableDictionary/tabledictionary.ext.php on line 11

Line 21 is the foreach

This is the offending code from autoload.php

   if (
        defined('Google_Client::LIBVER')
        && version_compare(Google_Client::LIBVER, '2.7.2', '<=')
    ) {
        $servicesClassMap = [
            'Google\\Client' => 'Google_Client',
            'Google\\Service' => 'Google_Service',
            'Google\\Service\\Resource' => 'Google_Service_Resource',
            'Google\\Model' => 'Google_Model',
            'Google\\Collection' => 'Google_Collection',
        ];
        foreach ($servicesClassMap as $alias => $class) {
            class_alias($class, $alias);
        }
    }
}
1 Like

Nice find Paul! :facepunch:
Then it is probably the same for me I guess… :thinking:

The question is of course how to get this stop what it doing, but since I’m not a hard core coder I have no idea.

Kind regards
PowerQuest

I’m also involved in this discussion. I think these issues are related.

https://community.suitecrm.com/t/warnings-after-upgrade-to-7-11-21-class-google-service-and-more-not-found/81675/9

1 Like

For anyone reading later…So the solution from the other post is to delete the Vendor folder in your root of installation, then run:

composer install --no-dev

from SSH to re-create your vendor folder with updated files. The errors disappear and the 500 error goes away and you can authorize your Google Calendar

1 Like