There was an error saving your invoice - self host

Hello; I was posting on Github but thought I should put this one here: When saving or clicking “Email Invoice” I get the message “There was an error saving your invoice Forbidden”

I am logged in as owner.
No errors in laravel error log file
No erros in apache
Latest version 2.9.3 (prepackaged )

I’ve checked the user account settings and can’t find the reason for this error

It looks like a permission issue however you wouldn’t expect any permission limitations if you’re logged in as the account owner.

Does this happen when both saving a new invoice and updating an existing invoice?

Also, can you check is_admin is true for your user in the users table in the database.

Does this happen when both saving a new invoice and updating an existing invoice?

The only time it does not happen is when “save draft” is clicked for new invoice. I will try making new invoice and make first click “email invoice” or other

Also, can you check is_admin is true for your user in the users table in the database.

is_admin is set to “1”

I had the same issue. It turned out that the upgrade to php 7.1 caused this. I previously used php 7.0.
So if you use 7.1 downgrading to 7.0 may solve this.

Thanks for letting us know, our next major release (v3.0) should hopefully solve the PHP 7.1 issues.

No, I’m running PHP 7.0

I was using an even older PHP version and upgraded to 7.0.

Any other suggestions I could try? I’m stumped. Could it have something to do with https vs http ? I recently switched it over to secured site so I could look into getting payment gateways set up.

Try loading /update (or /public/update) to check that all migrations have completed.

No go. I did this again for you just to be sure. Same behavior.

I’m 2 point releases behind -your churning out the code! I will update to 2.9.5 and see if this error msg still pops up then post again.

I don’t think it’s likely to help.

Can you provide more details. Did this just start happening or did you recently upgrade? If you upgraded from which version, and are you using a new server or the same one?

This error happened with version 2.9.3 (I believe it was a fresh install.) I created a new sub-directory and created a certificate for it (https://subdir.example.com/) When the error occured one thing I tried was to change it back to http but this did not change the Error.

No change in server otherwise, still my shared hosting on Funio.com

I’m going to create another install from scratch and see if it happens again. I may be the cause of it with all the mucking around. I will use v. 2.9.3 and no encrypted web.

Thanks for the info!

We haven’t heard about this problem from anyone else so it may be something specific to your setup.

A fresh install did not have any errors while saving the invoice.

I think the error was created when I changed the subdirectory name during an upgrade. .Htaccess? .ENV file? not sure. I combined too many thing into one step.

I’m now running php 7.0 with the latest version 2.9.5 and NO ISSUES! saving/emailing/deleting (I invoiced Thor-Son-Of-Oden but he never paid Haha :slight_smile:

Thanks for the support!

I spoke too soon!

Second invoice I made returned the error! ARg.

Okay, this time it’s a new install version 2.9.5. I’m tempted to give full access to anyone since I don’t even have any “real data” into the application yet. I just finished setting up paypal and wanted to test the results with a mock invoice and got the error again.

I have something more to report: If I turn off “Live Preview” under /settings/account_management then No error message when I click “Email Invoice” but no Email sent. I am able to Save Invoice without error.

With live preview ON, I cannot save or email invoice due to error.

Should the Laravel debug bar show something under the EMAIL tab when I click “email invoice”?

I am starting to wonder if my shared host is blocking something or I’m missing a PHP module.

MORE…

The error only occurs when I have “Attach Invoice” Checked under /settings/email_settings and I click “Email Invoice”

I hope this helps narrow it down. I need the pdf attached when I send it.

Are there any errors in your server error logs?

No Apache errors. No Laravel errors. I’m thinking this is js related. the error is returned quickly and no page reload. the debug bar returns nothing

I got last hint from reading the js code that the button linked to using firebug.

The page uses an AJAX call so you may not see the page request, you can check the network tab in the browser debug console to see if a request is being made.

The word ‘Forbidden’ is what’s shown when the permission checks fail. It would also explain why nothing is appearing in the logs. That said, you’re an admin so it shouldn’t fail.

Just Checked: when “attach invoice” selected and click “email invoice” I get nothing logged in the browsers debug network tab, error msg appears.

Also created a second user - Non-Admin - and had this user create invoice. Invoice saved but clicking “email” invoice" returned error.

Is anyone else able to create this error message?

Could you try tracing through the code to see where it’s failing.

If you add \Log::info(‘Test…’); it will appear in storage/logs/laravel-info.log.

Here’s the relevant part of the code:

https://github.com/invoiceninja/invoiceninja/blob/master/app/Http/Controllers/InvoiceController.php#L434