Skip to content

PHP Fatal error in cron job magento_giftcardaccount_update_states #35523

Open
@engcom-November

Description

@engcom-November

@fredden Reopening this issue reported by you as the old one is transferred to partnersee-repo
https://github.com/magento/partners-magento2ee/issues/681

Preconditions and environment

  1. Tested with Adobe Commerce v2.4.3-p1. Other versions are also affected.
  2. Create a new Website and associated Store but no store view
  3. cron enabled

Steps to reproduce

  1. Created new website and Store (Stores - All Stores) but no store view
  2. Reindex and clear cache
  3. Inserted record in cron_schedule table with job_code "jmagento_giftcardaccount_update_states"
  4. ran cron job from CLI:
  5. php bin/magento cron:run --group magento_giftcardaccount_update_states;
    Output: Job ran successfully without any errors
  6. Verify message in cron_schedule table:

Note: Other records inserted gives no errors.
Note: If Store view is created for the new store, error is not displayed on performing above steps.

Expected result

No PHP error should be displayed.

Actual result

PHP Fatal error is thrown.

app@686b4c600be7:~/html$ vendor/bin/n98-magerun2 sys:cron:run magento_giftcardaccount_update_states
Run Magento\GiftCardAccount\Model\Cron::updateStates PHP Fatal error: Uncaught Error: Call to a member function getId() on null in /var/www/html/vendor/magento/module-gift-card-account/Model/Cron.php:91
Stack trace:
#0 phar:///var/www/html/vendor/n98/magerun2-dist/n98-magerun2/src/N98/Magento/Command/System/Cron/RunCommand.php(66): Magento\GiftCardAccount\Model\Cron->updateStates(Object(Magento\Cron\Model\Schedule\Interceptor))
#1 /var/www/html/vendor/symfony/console/Command/Command.php(255): N98\Magento\Command\System\Cron\RunCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 phar:///var/www/html/vendor/n98/magerun2-dist/n98-magerun2/src/N98/Magento/Command/AbstractMagentoCommand.php(363): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 phar:///var/www/html/vendor/n98/magerun2-dist/n98-magerun2/vendor/symfony/console/Application.php(1027): N98\Magento\Command\AbstractMagentoCommand->run(Object(S in /var/www/html/vendor/magento/module-gift-card-account/Model/Cron.php on line 91

Fatal error: Uncaught Error: Call to a member function getId() on null in /var/www/html/vendor/magento/module-gift-card-account/Model/Cron.php:91
Stack trace:
#0 phar:///var/www/html/vendor/n98/magerun2-dist/n98-magerun2/src/N98/Magento/Command/System/Cron/RunCommand.php(66): Magento\GiftCardAccount\Model\Cron->updateStates(Object(Magento\Cron\Model\Schedule\Interceptor))
#1 /var/www/html/vendor/symfony/console/Command/Command.php(255): N98\Magento\Command\System\Cron\RunCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 phar:///var/www/html/vendor/n98/magerun2-dist/n98-magerun2/src/N98/Magento/Command/AbstractMagentoCommand.php(363): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 phar:///var/www/html/vendor/n98/magerun2-dist/n98-magerun2/vendor/symfony/console/Application.php(1027): N98\Magento\Command\AbstractMagentoCommand->run(Object(S in /var/www/html/vendor/magento/module-gift-card-account/Model/Cron.php on line 91
app@686b4c600be7:~/html$

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Adobe CommerceThe issue related to the Adobe Commerce(EE) or B2B functionalityArea: UI FrameworkComponent: CronIssue: needs updateAdditional information is require, waiting for responsePriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions