Invoice not sent

Yes. At the moment i deleted again the recurring invoice and scheduled a new one.
The status is waiting so should be active.
I will see again…

@peopleinside I’m curious, does you invoice have an image? if yes, could you check how large it is or test without it? this would include the company logo.

Logo is 538 x 338 png

That should be fine. Just to confirm with you what you already mentioned:

Manually executing the command /usr/local/bin/php /path/to/ninja/artisan ninja:send-invoices yields no errors? you should see something similar to this:

Fri, 07 Feb 2020 21:45:42 +0000 Running SendRecurringInvoices…
Fri, 07 Feb 2020 21:45:42 +0000 5 recurring invoice(s) found
Fri, 07 Feb 2020 21:45:42 +0000 Processing Invoice: 3
Fri, 07 Feb 2020 21:45:42 +0000 Not billed - Sending Invoice
Fri, 07 Feb 2020 21:46:46 +0000 0 recurring expenses(s) found
Fri, 07 Feb 2020 21:46:52 +0000 Done

In the PHP Log (php_errors.log) you get a Warning. right?

In \ninja\storage\logs stacktrace.log and laravel-error.log have no errors. right?

No errors seems.
If i do the command by SSH nothing is showed just a new empty line

Could you try the verbose option to see if you can get some information? try: php artisan ninja:send-invoices -vvv

Tue, 11 Feb 2020 09:41:14 +0000 Running SendRecurringInvoices…
Tue, 11 Feb 2020 09:41:14 +0000 0 recurring invoice(s) found
Tue, 11 Feb 2020 09:41:14 +0000 0 recurring expenses(s) found
Tue, 11 Feb 2020 09:41:14 +0000 Done

Well that’s good. From the output, the second line tells are no recurring invoices active. Lets double check the results… Can you run the following query?

SELECT count(*) FROM invoices WHERE is_recurring = 1 and is_deleted = 0 AND ( end_date <= NOW() OR end_date IS NULL )

If the result is 0, or if you are not able to run the query, create a new recurring invoice and run the artisan command again. You should get something like “Tue, 11 Feb 2020 09:41:14 +0000 1 recurring invoice(s) found”

Results is 4?
https://i.postimg.cc/LXmNs7cG/Shared-Screenshot.jpg

Ok, I see that my query was missing a few conditions try this one (copied from the source) :

SELECT count(*) FROM invoices WHERE
is_deleted IS FALSE
AND deleted_at IS NULL
AND is_recurring IS TRUE
AND is_public IS TRUE
AND frequency_id > 0
AND start_date <= NOW()
AND (end_date IS NULL OR end_date >= NOW())

Now seems to be zero
https://i.postimg.cc/rFhCkjNF/Shared-Screenshot.jpg

great! one of these conditions is not being met:

deleted_at IS NULL
is_public IS TRUE
frequency_id > 0
start_date <= NOW()

so try this query:

SELECT deleted_at, is_public, frequency_id, start_date FROM invoices WHERE
is_deleted IS FALSE
AND is_recurring IS TRUE
AND (end_date IS NULL OR end_date >= NOW())

you should get 4 records

3 records
https://i.postimg.cc/Hnr5sD2Y/Shared-Screenshot.jpg

Thanks, lets do a test. Set up a new recurring invoice, use a test client with a contact that has your email. Then set the “Start Date” to a date in the past, like yesterday. Leave the end date blank, the frequency weekly (so you don’t have to wait a month). If you run the query:

SELECT count(*) FROM invoices WHERE
is_deleted IS FALSE
AND deleted_at IS NULL
AND is_recurring IS TRUE
AND is_public IS TRUE
AND frequency_id > 0
AND start_date <= NOW()
AND (end_date IS NULL OR end_date >= NOW())

you should get one row and if you run the artisan command you should see a “…1 recurring invoice(s) found” and “…Processing Invoice: #” and receive a new email (because the start date was set in the past). If you run the artisan command a second time you should still see the “…1 recurring invoice(s) found”, but no invoice will be processed, until a full week has passed. Let me know if you get the first recurrence.

Currently i can’t and want do test on Ninja Invoice also because if I’m not wrong is hard to delete things you can only archive it. I will see at the start of march if i still having the same issue.

Or i need install a new test instance but i cannot do this now.
I will see… i cannot believe the software is bugged but if is I’m surprised no user are reporting.

Also is hard to me understand what’s wrong.
I will see if I will be able to try before having again the issue in march.
Thanks for your help.

Ok, I will do a test as well… I’m inclined to think is a configuration issue.

I set up a recurring invoice, Start Date Mar 1, 2020, Due Date set to the first of the month, no end date, monthly frequency, and no email on the client contact. If i’m missing anything on this setup or got something wrong, let me know.

Due Date is set at the 5th day for me.
I have set end data in December of 2021.
No email on the customer field.

Thanks.
My server is Apache with PHP 7.3

This is what i have to report:
1.The recurring invoice status is “Active” and it shows: Sent Last: Mar 1, 2020 and Send Next: Apr 1, 2020
2.The invoice was created and is listed in the “Invoices” section, with the status set to “Draft”. It was not sent as the single contact for the client did not have an email set.
3.The laravel-error.log shows the following error: [2020-03-01 17:01:43] production.ERROR: PhantomJS - Invalid response http://localhost/view/bm07tluadxllvpjemhvrllpvyqv6bntx?phantomjs=true&phantomjs_secret=82Sufdktfore3kWp8zzlkdz5fkshom5q: {“statusCode”:404,“error”:“Not Found”} {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“Admin Test”,“method”:“GET”,“user_agent”:"",“locale”:“en”,“ip”:“127.0.0.1”,“count”:1,“is_console”:“yes”,“is_api”:“no”,“db_server”:“mysql”,“url”:"/"} []
However, the invoice is shown when clicking “View in Portal” for the contact that has no email set (eg. http://localhost/view/bm07tluadxllvpjemhvrllpvyqv6bntx).

Other 2 invoices i set up as tests where generated and the notifications sent as one would expect, and did not produce any errors in the logs.

Yes also this month the invoice was not created.
Seems i have not particular error log. I found a possible error with SMTP email, fixed.
I’m forced to insert an email in the customer profile (i don’t like this) and now generated sent manually.

That is strange. Even without an email, the invoice should have been created, just not sent.