There was an error saving your invoice - self host

Ok, that’s helpful. It’s clearly related to user permissions.

I’m not sure why no one else is seeing this problem though…

After installing Version 3.1.1, I am unable to consistently re-create this issue. It now seems that around one-in-10 attempts to send/save invoice/quote returns the error.

This leads me to think it is my internet connection or something to do with the new feature which was added for editing the email (AWESOME, most loved feature yet). I do have very poor internet service (rural Canada). Possibly there is a Server/Client handshake for permissions that takes place which gets corrupted. There are large differences between upload and download speeds for me. Since nobody else is seeing this issue, It’s my best guess.

No longer able to give a reliable way to re-create the error message, consider it solved. Thanks!

Great to hear!!

This Bug is NOT DEAD. I am 100 percent sure this bug is related to documents being attached - Either to the invoice or documents attached to expenses which are then attached to invoices.

I’ve noticed two things:

When a document is attached to an invoice, the SQL statement reads:

insert intodocuments(disk,user_id,account_id,public_id,preview,path,type,size,hash,name,width,height,updated_at,created_at) values (‘documents’, ‘1’, ‘1’, ‘4’, ‘b7bvxpderexsjfy0slbqpsbonebnednm/af7d5f4dd0338ed769c6dd3b90df857957608e8f.jpeg.x300.jpeg’, ‘b7bvxpderexsjfy0slbqpsbonebnednm/af7d5f4dd0338ed769c6dd3b90df857957608e8f.jpeg’, ‘jpeg’, ‘38801’, ‘af7d5f4dd0338ed769c6dd3b90df857957608e8f’, ‘IMG-03.jpg’, ‘320’, ‘240’, ‘2017-07-12 04:10:33’, ‘2017-07-12 04:10:33’)

The ‘invoice_id’ is not given. I’m pretty sure this is an issue. Read on…

At this point I cannot save the invoice without getting the error message So I click “remove file” under the thumbnail image.

Using Laravals debug bar I cannot see any SQL asking for a delete or update to the document table. When I click on Save Draft I see this SQL

select * fromdocumentswheredocuments.invoice_idin ('1') order byidasc

However, a check of the ‘documents’ table reveals that nothing has changed. Also, the files are not deleted from the “Storage/documents” folder. When you view the front end it shows no attachments. That’s because every row in the documents table has the invoice_id value set to NULL.

I have no idea how this causes the error, but I’m sure it’s doing it somehow.

It is more complicated because the behavior changes after the very first insert of the document table. I simply wish I had more time to test.

The document is first saved (the insert query listed) and then when the invoice is saved the document should be linked to the invoice.

  • Are you saying this is a separate or the same issue to the one first reported?
  • Are you able to replicate the problem in a clean install?

Until we’re able to replicate the problem it will be very hard for us to fix it.

Same issue as first reported. “There was an error saving your invoice Forbidden” when either saving or sending, an invoice. I’ve narrowed it down to ONLY when a document is attached to the invoice, but not ALL WAYS. I have consistent repeatable fail with BRAND NEW install and First invoice and FIRST document attachment.

With a brand new install and NO documents attached ANYWHERE in the DB it never happens.

I’ve gone as far as making a completely separate CLEAN install with a test bed of known data that I import via CSV and jpeg files which are attached for test.

I can give the front end log in for someone to try my install out.

I’m not sure, we still haven’t had this error reported by another user.

If your clean install is on the same server it may be worth trying to test the app on a different server.

For future reference as this came up on google search for this error except it’ll say internal server error instead of forbidden…

If you put a currency label on the “unit cost” table when writing a quote or invoice it will result in this error.

For example a product being written as $50 vs 50 under the unit cost will result in an error.

Sorry to Bump this Thread, But this Error started occurring for me out of the blue in the last few week for two of my Installations.

When I try to Save Draft, Mark sent, Email Invoice or Setup a Recurring Invoice I get the same error.

There was an error saving your invoice
Forbidden

I have tried all of the suggestions above and it has not resolved.

Running PHP 7, Invoice ninja 4.5.5.

If anyone has any ideas ?

Thanking you in advance

Alex.

Are there any details in the web server error logs?

Hi Hillel…

If you mean my Cpanel web server Error then Yes… every time I try one of those functions that errors I get an error log entry as below.

2018-11-13 00:18:25.437827 [INFO] [210.49.65.170:54554] File not found [/home/driveshare/portal.drivesharerentals.com.au/403.shtml]
2018-11-13 00:00:59.491002 [INFO] [210.49.65.170:53989] File not found [/home/driveshare/portal.drivesharerentals.com.au/403.shtml]
2018-11-12 23:57:39.959309 [INFO] [210.49.65.170:53963] File not found [/home/driveshare/portal.drivesharerentals.com.au/403.shtml]
2018-11-12 22:51:58.643786 [INFO] [210.49.65.170:53343] File not found [/home/driveshare/portal.drivesharerentals.com.au/403.shtml]

Thanks

Alex.

Not sure… did anything change which caused the problem?

I did nothing.

But it affected two of my Installations at the same time Different Domains, same host…

could it be something my host has done ??

Alex.

It’s possible, you may want to check with them.

ok

I will check.

Thanks

Alex

Hi Again.

I have run a few tests and this is what I have come up with.

After Backing up to a JSON File. I did a clean install of Invoice ninja 4.5.5 via Softaculous.

After installing a Vanilla Invoice Ninja install, everything works fantastic.

Then I import my JSON FIle and same problem happen as above.

So I did another Fresh install of Invoice Ninja and manually typed all of the settings into that fresh install (No Imports from Backups).

All worked well until I went to email an invoice via the “Email Invoice” button.

I got the same error as above and now I can not save new invoices again.

So I think I have eliminated a problem on the web-hosts side as a fresh installation works fine.

Do you have any other ideas I can look at as this has got me puzzled.

Alex.

Sorry, not sure…

That’s really Disappointing…

What error are you seeing in the logs?

Web Error logs show the following error everytime the Invoice ninja error happens.

2018-11-16 08:19:07.771369 [INFO] [210.49.65.170:63761-Q:391831817271783640-13] File not found [/home/akke/public_html/403.shtml]

Thanks

Alex.