Invoice reminders not sent

Yes, I posted the config further up and we checked the output.

Here are the crontab entries:
4-59/5 * * * * cd /home/beechesit/domains/accounts.beeches.it && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1
3-59/5 * * * * cd /home/beechesit/domains/accounts.beeches.it && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty

I suspect this is the root cause:
[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘accounts.jobs’ doesn’t exist at /home/beechesit/domains/accounts.beeches.it/vendor/laravel/framework/src/Illuminate/Database/Connection.php:423)

If the queue is set to sync then I don’t believe the jobs table is needed.

@david do you have any suggestions?

Does it matter if this is in my .env file:

INTERNAL_QUEUE_ENABLED=false

I set that following the advice from here Free Source Available Invoicing, Expenses & Time-Tracking | Invoice Ninja to get the supervisor working.

Ooh, I found this in /var/log/invoiceninja-worker.log (in the server root, not the site root)

In Connection.php line 829:
                                                                               
  SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: s  
  elect table_name as `name`, (data_length + index_length) as `size`, table_c  
  omment as `comment`, engine as `engine`, table_collation as `collation` fro  
  m information_schema.tables where table_schema = 'accounts' and table_type   
  in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)                   
                                                                               

In Connector.php line 65:
                                                    
  SQLSTATE[HY000] [2002] No such file or directory  
                                                    

  2024-06-27 08:25:16 App\Listeners\Contact\UpdateContactLastLogin ... RUNNING
  2024-06-27 08:25:16 App\Listeners\Contact\UpdateContactLastLogin  111.87ms DONE
  2024-06-27 08:25:16 App\Listeners\Misc\InvitationViewedListener .... RUNNING
  2024-06-27 08:25:16 App\Listeners\Misc\InvitationViewedListener  108.26ms DONE
  2024-06-27 08:25:21 App\Listeners\Invoice\InvoiceViewedActivity .... RUNNING
  2024-06-27 08:25:22 App\Listeners\Invoice\InvoiceViewedActivity .... 1s DONE

invoiceninja-worker.log.txt (5.0 MB)
Here’s the whole worker log in case it’s useful. Didn’t know it was there.

Perhaps a more relevant error message is this penultimate one from laravel.log

[2024-07-09 13:40:27] production.ERROR: Call to undefined method Illuminate\Console\View\Components\Task::runTimeForHumans() {"userId":1,"exception":"[object] (Error(code: 0): Call to undefined method Illuminate\\Console\\View\\Components\\Task::runTimeForHumans() at /home/beechesit/domains/accounts.beeches.it/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php:45)

The whole file is attached above.

Any news on this? I can send reminders manually for now but I need to get the automated reminders working eventually.

Sorry for the lack for response, if you think there’s a bug in the app I suggest creating an issue on GitHub.

The situation’s getting worse, I now have “php is not writable” errors in the Health Check window and I can no longer view PDFs. I see I’m in good company with all these issues. All features I need are here, I just can’t work out how to use them and I need to get my invoices out quickly!

Should I do a clean reinstall? If so, can I re-import all my data?

Should I install from a Docker image instead so it’s more of a known environment, or will that just create as many problems as it solves? Again, what happens to my data?

Should I migrate everything to the hosted platform? Is that even possible?

Should I give up? I’m guessing you don’t want to lose customers but you’re probably sick of hearing about my problems by now.

Update: I may have found a workaround for the PDF issue (incorrect library dependency) and the missing reminders (incorrect cron job documentation). Still struggling with php not writable, nothing in logs and chmod 777 on absolutely everything doesn’t help. Still tempted by docker but can’t find docs. Getting late, will separate issues and update tomorrow.

I may have found a solution to the “invoice reminders not sent” issue.

In the documentation for v4 under SELF HOST > Configure > Recurring invoices and reminder emails there is reference to setting up a pair of cron jobs to to call the ninja:send-invoices and ninja:send-reminders commands. The send-invoices one just returns an error but the send-reminders one does appear to have triggered the sending of at least one reminder.

However, I can find no mention at all of an equivalent cron job in the v5 documentation. If this is indeed an omission it’s a serious one.

Update: Schedules are still not happening. No emails received as a result of the BCC option and under Advanced settings > Schedules the “Next run” is in the past.

Is there another missing cron job I don’t know about?

Also, I managed to get rid of the errors in the /var/log/invoiceninja-worker.log which now looks fine, but it has not improved the delivery of reminders or scheduled statements.

2024-10-05 13:57:43 App\Jobs\Product\UpdateOrCreateProduct … RUNNING
2024-10-05 13:57:43 App\Jobs\Product\UpdateOrCreateProduct … 89.76ms DONE
2024-10-05 13:57:53 App\Listeners\Invoice\UpdateInvoiceActivity … RUNNING
2024-10-05 13:57:54 App\Listeners\Invoice\UpdateInvoiceActivity … 1s DONE
2024-10-05 14:02:27 App\Jobs\Product\UpdateOrCreateProduct … RUNNING
2024-10-05 14:02:27 App\Jobs\Product\UpdateOrCreateProduct … 78.90ms DONE
2024-10-05 14:02:37 App\Listeners\Invoice\UpdateInvoiceActivity … RUNNING
2024-10-05 14:02:38 App\Listeners\Invoice\UpdateInvoiceActivity 810.39ms DONE
2024-10-05 14:28:26 App\Listeners\Contact\UpdateContactLastLogin … RUNNING
2024-10-05 14:28:26 App\Listeners\Contact\UpdateContactLastLogin 94.13ms DONE
2024-10-05 14:40:20 App\Listeners\Statement\StatementEmailedActivity RUNNING
2024-10-05 14:40:21 App\Services\Email\Email … RUNNING
2024-10-05 14:40:21 App\Listeners\Statement\StatementEmailedActivity 797.08ms DONE
2024-10-05 14:40:24 App\Services\Email\Email … 3s DONE
2024-10-05 14:40:25 App\Listeners\Mail\MailSentListener … RUNNING
2024-10-05 14:40:25 App\Listeners\Mail\MailSentListener … 201.38ms DONE
2024-10-05 14:49:17 App\Jobs\Invoice\UpdateReminders … RUNNING
2024-10-05 14:49:19 App\Jobs\Invoice\UpdateReminders … 1s DONE

The v4 docs only apply to the v4 app.

I’m not sure if the BCC setting applies to statements, you may want to try sending it directly to yourself instead.

I’ve just inherited a bunch of customers and this issue has become urgent. What can I do to get this resolved?

The ninja:send-reminders solution I mentioned above seems to have only worked once. I didn’t really expect it to work anyway because it’s a v4 thing so I think that’s a dead end.

The thread is a bit confusing now and I think there’s more than one problem (invoice reminders not being scheduled and reminders not being sent even when they are scheduled) so here’s a summary of the current status as I see it.

  1. If I look at the dates on my overdue invoices, only the most recent has a “Next send date”. How do I enable reminders for the older ones?

  2. Even when there is a sent date, nothing happens when the date is reached. The ones in the screenshot that show a date in the “Reminder Last Sent” column were manually triggered by me, not automatically as configured. As far as I can tell, reminders have never been sent automatically by the system. I have a BCC set up so that I see them. That BCC works when invoices are sent out.

  3. I have two cron jobs set up, both to run every 5 minutes and neither of which return errors (with the /dev/null removed, obviously). They run as the web user (“beechesit” in this case).

cd /home/beechesit/domains/accounts.beeches.it && /usr/bin/php artisan schedule:run >> /dev/null 2>&1 
cd  /home/beechesit/domains/accounts.beeches.it && /usr/bin/php artisan queue:work --stop-when-empty

  1. I am not currently seeing any relevant errors in the logs, either at the time of invoice creation or at the time the reminders are supposed to be sent.

Hi,

  1. Try resaving the reminder settings, if that doesn’t help try resaving an individual invoice to see if it sets it
  2. Please try adding EXPANDED_LOGGING=true to the .env file, you should see additional info in the logs
  3. schedule:run should be set to run every minute, you may want to try disabling the queue to see if it makes a difference
  4. See #2

Also, please check that you’re using the latest available version of the app.

Resaving reminder settings and invoices has made no difference, however there is some progress.

I was trying to change settings in “Email settings” and getting a frustrating “Something went wrong” popup every time I saved them. I tried saving in the desktop client instead of the browser and it succeeded - and a bunch of reminders went out! (All out of date, which I now have to apologise for.)

The only problem is, I’m not sure which setting (if any) made the difference. The test emails have always worked. And I’m still seeing that “something went wrong” message from a browser.

I now see these entries in the “expanded logging”, which I’ve never seen before:

2024-11-05 22:00:27 App\Listeners\Mail\MailSentListener ....... 14.29ms DONE
 ................... 2s DONE
  2024-11-05 22:00:27 App\Jobs\Mail\NinjaMailerJob ...................  2024-11-05 22:00:27 App\Listeners\Mail\MailSentListener 1s DONE

So that’s encouraging as well.

The problem with the blank “Next Send Date” hasn’t changed, which I think probably means the burst of reminders was a one-off. Only time will tell.

The other bit of information I can report is that when I said before that the “next send date” was sometimes in the past, I can now only see those on “Sent” invoices. That’s still confusing (would be better blank) but not necessarily a symptom of the reminder failure. Also, I have seen the nonsensical “next date in the past” on overdue invoices previously (there’s a screenshot of that further up the thread, I’m not imagining it). So something has changed - I’m on a later version of InvoiceNinja now so perhaps a bug was fixed.

It’s getting late so I’ll continue tomorrow but at least there’s some progress to report.

Are there any details about the “something went wrong” error in storage/logs?

I don’t think so. There are some new errors but I’m not sure they’re related. They may be simply due to me experimenting with different settings to try to find the problem by trial and error. An example is:
[2024-11-05 23:00:26] production.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'expense_mailbox' in 'field list'

I’m tied up at the moment dealing with fallout from a bunch of customers receiving reminders for invoices they’ve already paid. :frowning:

I may have found the cause, though - it seems to correlate with having any entry at all in Advanced Settings > Email Settings > Reply-To Name

That error implies you may need to run php artisan migrate

@david any ideas why setting the reply to name affects it?

I got a cron error about that setting in .env as well. Probably a space in the name (lack of quotes)?