Issue Bug Closed

#94586Default database instead of external database called when starting scheduler task via CLI

Alexander Rotzsch 07/19/21, 15:35 updated 02/26/25, 19:52

Description

Hi there,

I have an environment with 2 configured external databases. All is fine, fetching data from these databases work as expected. Additionally there’s EXT:external_import installed where in one of the custom steps I fetch data from an external database via Doctrine-Queries. The associated scheduler task fetches the data and it works if I manually run the task via backend scheduler.

Now the problem: This doesn’t work if the task automatically starts via CLI/cronjob. Then the external database is not called but the default one, which of course can’t work. In that case the following log message is stored in tx_externalimport_domain_model_log:

SELECT command denied to user ‘username’@‘localhost’ for table ‘pages’ [0]

The current workaround is to bypass doctrine and directly connect to the database via pdo methods -> this works (with the same database configuration parameters). I already approved that it’s not an external_import issue: https://github.com/cobwebch/external_import/issues/197

——-
TYPO3 10.4.17
external_import 5.1.1

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 5

  1. Georg Ringer commented and changed status New Needs Feedback 06/05/24, 21:43

    sorry for the late response!

    did you find a solution? I suggest that via CLI no TYPO3_CONTEXT is set and therefore the wrong config is set for TYPO3?

  2. Alexander Rotzsch commented 06/07/24, 13:24

    No news on this. The workaround is still used, but now in TYPO3 11.

    TYPO3_CONTEXT is a good point and probably the cause. Any idea how to properly solve this?

  3. Garvin Hicking commented 06/07/24, 19:05

    You could call the scheduler like this:

    TYPO3_CONTEXT="Production/Production" php /path/to/vendor/bin/typo3 scheduler:run

    (Using your web context value, might be different from Production/Production)? The environment variable would be passend on.

    Another possibility is to use an env file and for example helhum/env-connector. This hooks into composer and would always pass on the TYPO3_CONTEXT.

  4. Christian Kuhn changed Related to #102960 12/11/24, 12:13

  5. Georg Ringer commented and changed status Needs Feedback Closed 02/26/25, 19:52

    closing issue as there are 2 possible options to fix it, .env or providing the context