Recurring invoices not sent

Hi there,

I see there is a similar thread but I don’t think I should pin to it, because my problem is slightly different.
Anyway, I have problem with sending of recurring invoices. Invoices are generating and saving as drafts, but send is not happening.

I’m sure of a few things:

  1. I can send emails with invoices manually, it works everytime manually. By recurring invoice, it is not working.
  2. No errors in laravel.log.
  3. I have the newest version of Invoice Ninja.
  4. Recurring invoice changed Last Sent Date and Next Send Date.
  5. Every recurring invoice has settings for endless cycle and sending every month, no auto payment.
  6. No logs in these generated drafts, seems like invoices were never sent.

I read similar threads and sadly didn’t find any clue for solving this problem. What do you think?

Hi,

Can you check auto email is enabled on Settings > Workflow Settings

1 Like

Oh my… Thank you! Such simple mistake on my side… Shame on me.

1 Like

No worries, happy to help!

1 Like

Hello there,

I’m having the same problem, already checked the “auto email” and it was already enabled.

I have some recurrent invoices that were supposed to be sent 3 days ago, it shows “Actif” in the status, but the “next send date” it’s still the same and the invoice was not created.

Do you have another idea?

@david do you have any suggestions?

It sounds like the crons are not running here, they will check every hour. So my suggestion would be to double check your cron configuration.

Hi @david ,

I tried to check that.

I have run the command line : * * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Without the “* * * * *”, it doesn’t work on my server with it.
but, the result is just nothing and I don’t know how to check.

I’m connected in a SSH client to do that, I have done for the email configuration and it’s working. but not the recurrent invoice.

I saw the message " Ensure you set the scheduler under the web server user i.e. sudo -u www-data crontab -e" but I don’t have a root acces. Do you think it could be it? Can I check this if it’s enable?

Can you help me with the cron? I’m not an expert on that :smiley:

If you are on shared hosting, then i believe the actual webuser will be the correct one, so we can exclude that as an issue.

You may want to have a look at your other cron configurations, It may be that your cron needs to define all the full PHP path.

I would also suggest changing >> /dev/null 2>&1 to a file where you can monitor the output of the cronjob so that you can inspect for any errors that are being thrown.

Hello @david ,

Thank you for the information.
I have a “Cloud server Linux”
I’ve tried to do everything I found in the internet.
I saw in the “check system” it had a “Cron not enabled” and after changing some things, used the “artisan optimize” now it desappeared.

but, when I try to run the https://invoiceninja/webcron?secret=secret, it shows “{“message”:“Web cron has not been configured”}” and the recurrent invoices are not been sent/created.

I created a file to save the logs and the last I have is this one :
"
2023-02-13 11:40:57 Running [queue-size-job] … 6ms DONE
2023-02-13 11:40:57 Running [Callback] … 17ms DONE

INFO Processing jobs from the [default] queue. "

Just a new information…
When I changed the .env file to “QUEUE_CONNECTION=database” the message from “QUEUE not enable” desapears but the problem continues and I can’t send the emails directly, I need to use a command line “artisan schedule:run” to send all the emails I tried before, so, I put back the “QUEUE_CONNECTION=sync”

any new idea?

Ok.
After a day trying.

I edited the crontab file, and put the line

          • cd /sites/gestion.cavetech.ch/ && /opt/php8.1/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

But it still not working.

When I try “artisan ninja:send-recurring” it works.
I don’t know if is something connected to the user, I read something about the “www-data” user, but I don’t think I have access to that.

@cavetech

You’ll want to enable expanded logging in your .env to see what is going on here:

in your .env file add the following line

EXPANDED_LOGGING=true

Then update the cache again. Every hour, there should be logs in

storage/logs/invoiceninja.log

Showing the output of the Recurring Invoice Cron job.

If there is no text referencing this, it means the crons are still not running.

Hello ,

Thank you… I think now is working.

I really don’t know exactly what worked, because I did a lot of attempts and one worked.

This is the log :

[2023-02-17 09:00:10] production.INFO: Sending invoice reminders on 2023-02-17 09:00:10
[2023-02-17 09:00:10] production.INFO: Sending recurring invoices 2023-02-17 09:00:10
[2023-02-17 09:00:10] production.INFO: 2023-02-17 Sending Recurring Invoices. Count = 0
[2023-02-17 09:00:10] production.INFO: Recurring invoice send duration 2023-02-17 09:00:10 - 2023-02-17 09:00:10
[2023-02-17 10:00:07] production.INFO: Sending invoice reminders on 2023-02-17 10:00:07
[2023-02-17 10:00:07] production.INFO: Sending recurring invoices 2023-02-17 10:00:07
[2023-02-17 10:00:07] production.INFO: 2023-02-17 Sending Recurring Invoices. Count = 0
[2023-02-17 10:00:07] production.INFO: Recurring invoice send duration 2023-02-17 10:00:07 - 2023-02-17 10:00:07
[2023-02-17 11:00:12] production.INFO: Sending invoice reminders on 2023-02-17 11:00:12
[2023-02-17 11:00:12] production.INFO: Sending recurring invoices 2023-02-17 11:00:12
[2023-02-17 11:00:12] production.INFO: 2023-02-17 Sending Recurring Invoices. Count = 0
[2023-02-17 11:00:12] production.INFO: Recurring invoice send duration 2023-02-17 11:00:12 - 2023-02-17 11:00:12
[2023-02-17 12:00:07] production.INFO: Sending invoice reminders on 2023-02-17 12:00:07
[2023-02-17 12:00:07] production.INFO: Sending recurring invoices 2023-02-17 12:00:07
[2023-02-17 12:00:07] production.INFO: 2023-02-17 Sending Recurring Invoices. Count = 0
[2023-02-17 12:00:07] production.INFO: Recurring invoice send duration 2023-02-17 12:00:07 - 2023-02-17 12:00:07
[2023-02-17 13:00:08] production.INFO: Sending invoice reminders on 2023-02-17 01:00:08
[2023-02-17 13:00:08] production.INFO: Sending recurring invoices 2023-02-17 01:00:08
[2023-02-17 13:00:08] production.INFO: 2023-02-17 Sending Recurring Invoices. Count = 0
[2023-02-17 13:00:08] production.INFO: Recurring invoice send duration 2023-02-17 01:00:08 - 2023-02-17 01:00:08

Thank you!

This looks good now!

1 Like