403 Forbidden only when adding gateway

Hi

I’m self hosting running v4.5.11.

When I try to add a payment gateway I get a 403 Forbidden page. The rest of Invoice Ninja works fine. This is the only page where I get this error.

From the laravel-error log:

[2019-03-12 00:00:38] production.ERROR: Illuminate\Contracts\Encryption\DecryptException [0] : /home/XXXXX/public_html/invoice/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php [Line 180] => The payload is invalid. {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“XXXXX”,“method”:“GET”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0”,“locale”:“en”,“ip”:“XXXXX”,“count”:11,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“settings/online_payments”} []

[2019-03-12 00:03:24] production.ERROR: Illuminate\Contracts\Encryption\DecryptException [0] : /home/XXXXX/public_html/invoice/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php [Line 180] => The payload is invalid. {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“XXXXX”,“method”:“GET”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0”,“locale”:“en”,“ip”:“XXXXX”,“count”:14,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“api/gateways”} []

There were other topics I found here with this issue but no solution.
There was mention (https://www.invoiceninja.com/forums/topic/troubleshooting-a-403-error/) of a mod_security rule causing the problem. However, this doesn’t mean anything to me. Perhaps someone can expand on this?

Any help is appreciated.

The encrypter error implies it may be related to the APP_KEY in the .env file, have you moved the app or changed the key value?

I actually recently updated the app manually by copying over the new files. I did run into some issues and ended up just deleting the whole invoice ninja folder and extracting the new version in its place.
I’m still using the same database.

Prior to updating I had not tried to add a payment gateway, so I can’t say if this issue existed before.

In the future it would be helpful to share this info when first posting…

Are there any rows in the account_gateways table?

Sorry, didn’t think it was relevant.

And account_gateways is empty. I haven’t configured any gateways yet. I actually tried to add one manually via phpmyadmin but couldn’t get that to work.
I’m a little new to all this server and hosting stuff.

Is there a value set for APP_KEY in the .env file?

You may want to try setting up a clean install and then transferring over your data.

Yes, there is a value. I’m guessing this value is now different from the previous one and hence the conflict?
Just for future reference, are there any other files that should remain intact when updating?

As for clean install and transferring, could you please provide basic steps for doing that. Also, wouldn’t what I did with deleting the entire invoice ninja be considered a clean install?

If there is a row in the table marking it as archived/deleted may help.

You need to keep the .env file and any documents you uploaded (ie, invoice attachments).

account_gateways table? Nothing at all.
May help with doing what? Sorry, it’s a little vague.

Appreciate the help!

If the table is empty I’m not sure why you’re seeing the error.

As a next step I’d suggest setting up a clean install of the app.

Would it make things easier if I don’t mind losing all data? I haven’t used it much yet.

You should be able to transfer your data/settings using the JSON import/export.

Okay, I just figured out how to JSON export/import via phpmyadmin.

So, to make sure I understand this correctly, I would export the current database then import it to a new one? Wouldn’t this be the same as keeping the database then just linking back to it with a clean install. Because this is actually what I did when the update failed; I created a whole new invoice ninja then linked to the existing database.

The JSON export is in the app on Settings > Import/export

You’d want to test with a blank new database.

lol ok, silly me.

I’ll give it a shot and report back.

So I just completely started from new. Clean install and a new database but I’m still getting the same problem :frowning:
I didn’t even import the previous data, just started from new.

Could it be an issue with proc_open not being enabled? After clean installing and during the initial setup, there was a warning message saying that I need to have proc_open enabled and I wasn’t able to proceed. However, I was somehow able to proceed without enabling it after many failed attempts (not sure how it worked, it was a fluke).
This actually helped me recall that I had this same proc_open error when I first installed Invoice Ninja many months ago but had forgotten about it (I hadn’t really started using Invoice Ninja until just a few days ago; I was just setting up and preparing it). Even back then I was eventually able to get Invoice Ninja working.

It’s possible but I’m not sure if it’s the cause, proc_open usually causes problems when trying to update the app.

Any other ideas?

Is it possible the new install isn’t completely clean? You may want to try setting up an totally fresh install on a different server.

Well I deleted the Invoice Ninja folder on the server and created a new database. Does that count as completely clean?

And I don’t exactly have access to another server…