There was an error saving your invoice - self host

For me, still no change.

  • I've updated to 3.0.2 and run billing.thomashepburn.ca/public/update (zip file from website, not github)
  • I tried inserting logging \Log::info('Test...'); in invoicecontroller.php but it did not trigger as expected. I will try with new files.

It looks like the code link above is out of date, the relevant code is emailInvoice. It’s called in both the store and update functions.

If this helps, after I updated (from github) I ran deleted the php files in the cache folder, then ran php artisan optimize

I’m on a shared host server. Not familiar with this “php artisan optimize”. Is it accessible through URL in browser?

I’m playing with app/Http/Controllers/InvoiceController.php in an attempt to track down this error message still.

Entered Log::info('update info');

and got this in debug Class 'App\Http\Controllers\Log' not found/home/hepburn/public_html/billing/app/Http/Controllers/InvoiceController.php#383

I tried with Log::error('error…'); and it logged an error in Laravel-error.log…with a mile of extra garble.

I’m not understanding why info error logging is not working. It may be beside the point. I just want to put more meaningful info logging injected into the code to help track what causes this Error message to appear.

I will look at the other files you’ve pointed to.

Could it be from some cached data locally? I’ve noticed that I do not have to log in after machine reboot which should not be the case. How/where does the app check that I’m logged in and have permissions? is this info stored in a cookie? Maybe this is the issue?

I’ve also checked behavior in MS Edge and get the same thing.

You need to use a backslash. ie, \Log…

Yes, I am using backslash. Sorry my previous post didn’t include that. I’ve entered as you stated in reply
#5464 above. Full line is…

\Log::info('Test msg…');

In that case I’m not sure. Have you tried a clean install, transferring your data using the JSON import/export?

I haven’t heard of this problem from any other user which makes me think the problem is with your specific install.

I just finished a test on a clean install v3.0.2 with fresh data entered upon setup (new db)

Same behavior: When I select “attach invoice” and attempt to email invoice it returns error. No attached invoice, it works fine; emails sent, yay.

Since Phantomjs is used, I created an account and swapped the demo key with my free API. No change.

Logic says it’s just me if attaching the invoice is popular (seems so from Q&A on Github about local phantomjs )

I’ll keep chipping away here. Any ideas you might have just throw them my way. I’m going to have to leave it for another week after today.

You may want to try using a local phatomjs install

https://github.com/invoiceninja/invoiceninja/blob/master/.env.example#L29

Success! Sort of.

There are At least TWO places to send emails from:

  1. From the Invoice Edit view where there are 4 buttons: Download PDF, Save Invoice, Email Invoice, More Actions^

In this view, clicking on Email Invoice returns A) A prompt that says “Are You Sure?” [client name] [email address]; click yes and I get another prompt that says “There was an error saving your invoice Forbidden” with OK

  1. From the Invoice LIST VIEW you can select one (multiple?) invoices, then using the DD-Listbox (defaulted to show “Archive”), you can select “Email Invoice” which briefly shows “successfully emailed invoice” at the top of the webpage then disappears. No other prompt appears.

Method 2 sends the email with an attached invoice!

This I’d call a work-around. In the edit window I’m able to save the changes to an invoice. I can also download, save, and attach the pdf as an “attached document” which gets sent.

Hope this helps.

Thanks, that’s helpful to know.

Same to me. Downgraded the php and problem gone. May be a bug.

Are you seeing the message “There was an error saving your invoice Forbidden"?

You may want to check the database migrations completed by loading /update (or /public/update) in the your browser.

This bug still persists in 3.1

I have also noted that message is triggered when you add attachments to a quote. Remove attachments and msg goes away. This happens when “include attachments” in settings is unchecked. Have not dug further…yet (error log etc etc.)

Which PHP version were you using and which did you downgrade to?

Thanks for the info! Can you please help clarify the problem, the thread includes a number of different points.

I thought you were seeing this error with invoices, not quotes. Knowing that it’s related to documents should help us track down the problem.

I now get the error on invoices AND quotes where quote has document attached.

I’m not sure, I’m not aware of other users seeing this problem.

Have you tried testing a clean install on another server?

Re-reading the post…

  • There are a number of different issues here
  • It looks like you’ve already tried a clean install

Can you confirm you’re seeing the exact same error: “There was an error saving your invoice Forbidden”. The word ‘Forbidden’ implies it’s an application permission issue, you can try adding return true; here:

https://github.com/invoiceninja/invoiceninja/blob/master/app/Http/Requests/UpdateInvoiceRequest.php#L16

I will get a chance to work on this in a couple of days. I will send you a screen shot of PHP modules I have active on host. Unfortunately I only have access to the one remote server right now.

Yes, the message reads There was an error saving your invoice Forbidden

I have updated to 3.1.1 then retested for bugs with no change; errors still appear when saving INVOICE and QUOTE with Document attached.

THEN I followed your code edit suggestion. Message did NOT appear when saving a Quote with documents attached and with Invoices being saved.