Question cron job runner issue

Status
Not open for further replies.

wmtech

Customer
We use a job runner, triggered by cron and not the usual one where the visitor object is available.

Is it possible to adapt your cron jobs to not require a visitor/user when they run? It would prevent such errors, we get sometimes when jobs are running:

Code:
In XF.php line 473:

Argument 1 passed to XF::asVisitor() must be an instance of XF\Entity\User,  null given, called in /src/addons/DBTech/eCommerce/Repository/License.php on line 408

Thanks!
 
Sorry, there is no stack trace, because there is no error in server log. This is just the message returned by the job runner via cron.

I will try to get more information when the error triggers again.

Thanks.
 
Now we have a stack trace, starting from the triggered runDailyCleanUp cron .

Code:
TypeError: Argument 1 passed to XF::asVisitor() must be an instance of XF\Entity\User, null given, called in src/addons/DBTech/eCommerce/Repository/License.php on line 408 src/XF.php:473
Generated by: Unknown account Jan 15, 2020 at 3:00 AM

Stack trace
#0 src/addons/DBTech/eCommerce/Repository/License.php(408): XF::asVisitor(NULL, Object(Closure))
#1 [internal function]: DBTech\eCommerce\Repository\License->DBTech\eCommerce\Repository\{closure}(Object(DBTech\eCommerce\Entity\License))
#2 src/XF/Mvc/Entity/AbstractCollection.php(189): array_filter(Array, Object(Closure))
#3 src/addons/DBTech/eCommerce/Repository/License.php(416): XF\Mvc\Entity\AbstractCollection->filter(Object(Closure))
#4 src/addons/DBTech/eCommerce/Cron/CleanUp.php(30): DBTech\eCommerce\Repository\License->sendExpiredAlerts()
#5 [internal function]: DBTech\eCommerce\Cron\CleanUp::runDailyCleanUp(Object(XF\Entity\CronEntry))


I've also checked our database. There are no licenses without a valid user_id. All have been imported from Xen Product Manager.
 
This means there's a license whose user record cannot be found. You may be able to find out which license(s) are affected by running this query:

SQL:
SELECT * FROM xf_dbtech_ecommerce_license AS license
LEFT JOIN xf_user AS user USING(user_id)
WHERE user.user_id IS NULL
 
This means there's a license whose user record cannot be found. You may be able to find out which license(s) are affected by running this query:

Thanks. There really are some licenses with non existing users. I would have expected such licenses would be automatically deleted if the user is deleted.

Can I simply delete those licenses in the database, because deleting them from acp is not possible either?
 
You can, yes. Licenses are deleted when users are deleted, this is likely due to imported licenses for users that are not longer valid.
 
Hello @wmtech,

We hope your ticket regarding DragonByte eCommerce has been addressed to your satisfaction. This ticket has now been scheduled to be closed.

If your ticket has not been resolved, you can reply to this thread at any point in the next 7 days in order to reopen the ticket, afterwards this thread will be closed.

Please do not reply to this thread if your ticket has been resolved.

Thank you.


- DragonByte Technologies, Ltd.
 
Hello @wmtech,

As we have not heard back from you, your ticket regarding DragonByte eCommerce has now been closed.

If your ticket has not been resolved, please feel free to start a new support ticket and link back to this ticket.

If you have time, please leave a review on XenForo.com's Resource Manager.

Thank you.


- DragonByte Technologies, Ltd.
 
Status
Not open for further replies.

DragonByte eCommerce

XenForo 2.0.6+ XenForo 2.1.x XenForo 2.2.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
2,425
Customer rating
4.83 star(s) 6 ratings
Back
Top