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

uvdesk:refresh-mailbox with Microsoft App lose connection after 90 minutes #772

Open
dwulfing opened this issue Aug 27, 2024 · 0 comments
Open

Comments

@dwulfing
Copy link

dwulfing commented Aug 27, 2024

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

  1. Connect the Microsoft App to Office 365 mailboxes.
  2. Set up a cron job to fetch emails every 5 minutes.
  3. Start the cron job at 11:10 PM.
  4. Emails are successfully fetched until 12:30 AM.
  5. 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

  1. Changes in vendor/uvdesk/core-framework/Controller/MicrosoftApps.php at 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.

  2. Changes in config/packages/uvdesk.yaml:

    • The "site_url" was adjusted avoid errors related to the webhook (API) delivery.
  3. 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!

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

2 participants
@dwulfing and others