Closed peec closed 7 years ago
After further investigation it seems that the encrypted fields that disappears after deploying.
Affected Braintree values that gets removed:
Affected PayPal values that gets removed ( Website Payments Standard and Express Checkout):
All other non encrypted information stays.
Hi, @peec. We can't reproduce described issue. Please, attach apache and magento logs. Also, if you use additional extensions, try to disable them and repeat deployment.
I am seeing the exact same symptoms and we're also using Braintree and a similar-ish deploy script. Typically what I see is the Public Key and Private Key are blank (as @peec mentioned) but there's still a green checkmark next to it in the list of payment methods.
Although we are now running PHP 7.0.3 and Magento 2.0.7 I experienced this issue on PHP 5.6 and all other versions of Magento 2.
Maybe relevant information, but we only version control composer.json and composer.lock for each Magento 2 site. We use memcache for backend cache and varnish. Media is stored in database. So basically the filesystem does not store anything.
So basically, all files are deleted per deploy.
On a deploy we:
All payments credentials are stored in the database. Also in my previous comment, I'm asked about logs and additional extensions.
I was able to reproduce this on a fresh installation of Magento deployed with zero extensions or themes installed.
Some notes about the environment: First, it's docker based. A docker-compose file spins up nginx, redis and php containers. Then Magento is installed via composer and configured to use an external MySQL database (in our case, this lives in RDS). Similar to @peec we only include the composer.json and composer.lock files when deploying the application.
Now onto how we replicated the issue.
First we deployed a new Magento instance to a blank database. After everything fired up we configured Braintree and were able to submit test orders as expected. Not much else to say at this point.
Next, we stopped the docker containers and then started them back up. This means the containers were started with all the application files present (vs the first time when it was just composer.json/composer.lock). At this point we expect to be able go to a product page, add it to our cart and submit an order using Braintree as the payment method. And indeed that is what happened.
Lastly, we stopped the docker containers and then deleted all application files except for the composer.json and composer.lock files then relaunched the docker containers. As with the previous step we expect to go right to a product page, add the product to our cart and submit an order using Braintree. Once we go to the Review/Payments step of checkout, we do not see Braintree listed. But instead an error in the browser's console that reads cc-form.js:159 Uncaught TypeError: Cannot read property 'addErrorMessage' of undefined
. So we go into the Payment Methods section in the Magento admin section and sure enough the Public Key and Private Key are missing and Enable this Solution is set to No.
If needed here's a docker-compose file that's very similar to ours: https://github.com/mageinferno/magento2-docker-compose
@m0zziter did you use 2.1 or 2.0.5 (from linked compose file)?
2.0.7 but I have seen this behavior on all 2.0.x versions of Magento.
I had some success, with the following: For some reason the config value for path=payment/payflow_advanced/user Which should be encrypted but has the unencrypted word PayPal in it (Set I don't know where, not in the db) and it gets a very dubious decrypted value. On my system this path did not exist in the core_config_data table. So I set the paypal api name to PayPal, then using phpmysql copied this (encrypted) entry to a new entry with a path of payment/payflow_advanced/user Then reset the paypal api settings to what they should be, and it worked (2.0.7) ymmv
@rplant09485, the partner field (PayPal value), should be not encrypted because it's not sensitive data.
HI,
Having similar issue with the braintree payment extension but the problem is that the payment is not appearing at all on the checkout page. Just saying no payment methods available.
I tried merge, unmerge js, tried moving braintree.js and utils to the footer (some said it cannot target container because it didn't rendered yet) with no success. Currencies are the same in sandbox and shop, I checked Public and Private keys multiple times as well as Merchant account ID.
Only error that shows in console is:
Uncaught Error: Unable to find an input with data-braintree-name="number" in your form. Please add one.
Using magento 1.9.20
Hi, @borishuseincehajic, this Github repo only for Magento 2. The Magento 2.1 uses new implementation of Braintree, which has full reworked frontend and backend code.
Ahh got it. Sorry about that. Thnx for the info.
@joni-jones I was playing around with 2.1 today (we're still using 2.0.7 in production) and experienced the same issue. Were you able to replicate? Do you need additional information?
Honestly this issue is a huge drag and is preventing us from using multiple webnodes so we'd like to get it resolved. Let me know if there's anything I can do to help that process along I'd be happy to oblige.
Hi @m0zziter, previously, I have tried to reproduce this issue. I had upgraded Magento from 2.0.4 to 2.0.7 and 2.1, the configuration doesn't disappear. I hadn't enough time to use you docker-compose and suppose will have time only after current sprint will be finished.
FYI, still reproduced in 2.1. Even re-installed a couple of times.
The encrypted fields are removed ( Braintree private and secret keys ) on deploy . Something seems to be wrong with the encryption of fields it seems. It doesn't persist on redeploy.
I think i solved the case now, had to read some code to figure this out. This is related to app/etc/env.php and the Encrypter relying on the filesystem.
As one only version control composer.lock and composer.json, env.php will be generated on each deploy and each physical server node being allocated to magento.
app/etc/env.php
<?php
return array (
//.....
'crypt' =>
array (
'key' => 'zzzzzzzzzzzzzzzz',
),
//.....
);
The crypt/key
has to stay the same on ALL nodes, and must never change. Changing it in a production system will make all the fields that are of type Magento\Config\Model\Config\Backend\Encrypted
be deleted. Since the decryption allgorithm doesn't work when the crypt key is not equal to what the string was originally encrypted with.
See
@peec That was definitely the cause of it! I tweaked my deployment script to specify an encryption key and sure enough the Braintree settings stuck around after deployment completed.
Thanks so much for your leg work on this one!
Hi @peec
We've created MAGETWO-57756 internal ticket for updating the documentation. Thank you.
Hi @peec starting from 2.2.0 release you can share config.php
file between instances and this file may contain all configurations you need to share. Configuration mechanism and options were significantly re-worked in 2.2.0 and several useful features have been added.
Magento version: 2.0.7 PHP version: 7.0.3
Every time i deploy payment configuration from sales tabs is flushed. And customers can NOT use payment methods.
The deployment routine is basically this:
Here is the exact script i run on every deploy to keep my install consistent.