uvdesk:refresh-mailbox with Microsoft App lose connection after 90 minutes
Hier ist der überarbeitete GitHub-Issue mit den zusätzlichen Informationen zu den Anpassungen, die du vorgenommen hast:
Bug Description
I am using the Microsoft App in UVdesk to fetch emails from Office 365. After making some code adjustments, both email reception and sending work as expected.
I have set up a cron job that fetches emails every five minutes. The job was started at 11:10 PM and ran smoothly until 12:30 AM. However, starting from 12:35 AM, I began receiving the following error message:
Retrieving mailbox configuration details for [email protected]:
An unexpected error occurred: Warning: Undefined variable $microsoftApp
Steps to Reproduce
- Connect the Microsoft App to Office 365 mailboxes.
- Set up a cron job to fetch emails every 5 minutes.
- Start the cron job at 11:10 PM.
- Emails are successfully fetched until 12:30 AM.
- From 12:35 AM onwards, the error mentioned above occurs.
Expected Behavior
The cron job should continue fetching emails without interruptions or error messages.
Actual Behavior
The cron job triggers an error after running for a certain period, indicating an undefined variable $microsoftApp.
Code Adjustments Made
-
Changes in
vendor/uvdesk/core-framework/Controller/MicrosoftApps.phpat Line 149:$redirectEndpoint = str_replace('http', 'https', $this->generateUrl('uvdesk_member_core_framework_integrations_microsoft_apps_oauth_login', [], UrlGeneratorInterface::ABSOLUTE_URL));changed to:
$redirectEndpoint = str_replace('http://', 'https://', $this->generateUrl('uvdesk_member_core_framework_integrations_microsoft_apps_oauth_login', [], UrlGeneratorInterface::ABSOLUTE_URL));This change was necessary to establish a connection with Microsoft.
-
Changes in
config/packages/uvdesk.yaml:- The "site_url" was adjusted avoid errors related to the webhook (API) delivery.
-
Changes in
vendor/uvdesk/mailbox-component/Console/RefreshMailboxCommand.php:- Modified the following lines to ensure the correct URL scheme is used:
$this->router->getContext()->setHost($this->container->getParameter('uvdesk.site_url')); $this->router->getContext()->setScheme('https'); // $this->router->getContext()->setScheme((bool) $input->getOption('secure') ? 'https' : 'http');The above change ensures that the emails are properly delivered via HTTPS.
Additional Information
- UVdesk Version: 5.4.42
- PHP Version: 8.1.2
- Webserver: Plesk with Nginx and Apache
- Operating System: Ubuntu 22.04.4 LTS
Possible Solution
The $microsoftApp variable might be getting lost or not correctly initialized after a certain runtime. It could be necessary to review and correct the initialization of this variable.
Du kannst diesen Text für deinen GitHub-Issue verwenden. Falls noch etwas fehlt oder du weitere Details hinzufügen möchtest, lass es mich wissen!