Closed prasannanwr closed 7 years ago
@hocomadvies describe sequence_order_1; +----------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------------+------+-----+---------+----------------+ | sequence_value | int(10) unsigned | NO | PRI | NULL | auto_increment | +----------------+------------------+------+-----+---------+----------------+ 1 row in set (0.00 sec)
is this how you created sequence_order_2 ? what do you see in sequence_order_0 ,1 and 2?
Ok, that may help :) my sequence_order_2 has no auto_increment added.
I now added it like this:
CREATE TABLE IF NOT EXISTS `sequence_order_2` (
`sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
So I also added this for the other tables: sequence_invoice_2 sequence_shipment_2 sequence_creditmemo_2
And now it all seems to work.
@schasiepen do you have any exception logs in var/log
or var/report
?
@SerhiyShkolyarenko: At first no errors in log files and no reports. But when I uncomment try/catch in PaymentInformationManagement funtion savePaymentInformationAndPlaceOrder(), I get this error message: Report ID: webapi-5840685d21343; Message: No such entity with orderId = 2 sequence_order_1 has 231 entries Autoincrement is 232.
The funny thing is that all orders are generated, Emails are send. I noticed: the table eav_entity_store is empty, tables sequence_order_0, sequence_order_2 and sequence_order_3 (I added _2 and _3) are empty. We have 3 store views (1: german, 2: italian, 3: english). Since "Share Customer Accounts" is set to "Global", and all customers are created in store 1, I guess it is correct that only sequence_order_1 is used?
Any help/hint is very,very welcome.
Any update on this issue? Does somebody know, which SQL Query would be responsible for the error "webapi-5840685d21343; Message: No such entity with orderId = 2" ? I have to admit: I'm completly lost!
@schasiepen do you have the other sequence tables for invoice/shipments/creditmemo's? and meta tables (see my higher up post for list of tables!) sales_sequence_profile && sales_sequence_meta along with the tables for sequence_invoice/shipment/creditmemo?
Any update on this Magento???
The tables for store 3 were all missing for me.
I am getting this same issue. I am using PayPal Payments Pro/Payflow and the credit cards are authorized instead of completing a sale. I am hoping for a solution to this. I was excited for the new Magento version but am having lots of issues with it.
I have version 2.1.1 and had tried setting the address to only 1 field and that did not help either.
@hubaig @craigcarnell @schasiepen It might help you guys finding a solution by investigating your dbase tables and have a look if they are similar as mentioned by above topics. Seems that its al about missing tables in the database somehow. Be sure to make a back-up from your database before changing anything :) Best way to access the database in this case is through phpMyadmin. I ran into more or less the same problems and it helped me to get it working again.
Thanks heaps everyone here. It's pretty annoying Magento does not log those errors.. The way around I found was overwriting the CouldNotSaveException class.
In your Custom Module di.xml (e.g.
<preference for="Magento\Framework\Exception\CouldNotSaveException" type="<NAMESPACE>\<PACKAGE>\Exception\CouldNotSaveException" />
Then create the file and add the content below:
<?php
namespace <NAMESPACE>\<PACKAGE>\Exception;
use Magento\Framework\Phrase;
use Magento\Framework\Exception\AbstractAggregateException;
class CouldNotSaveException extends AbstractAggregateException
{
/**
* CouldNotSaveException constructor.
* @param Phrase $phrase
* @param \Exception|null $cause
*/
public function __construct(Phrase $phrase, \Exception $cause = null)
{
$this->originalPhrase = $phrase;
parent::__construct($phrase, $cause);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$logger = $objectManager->create('\Psr\Log\LoggerInterface');
$logger->debug($cause->getMessage());
}
}
Then again. It's not the final solution, but help us to track the errors when they happen.
CHeers,
Renato.
@hocomadvies I checked both of the tables and they look fine. I migrated from Magento 1.9 to 2.1, could that be a cause of this? I also have m2epro installed and am not sure if that is causing any issues. I see that the Auto Increment items are there. I am not able to modify any tables now because clients have already made orders using Paypal express checkout.
@hubaig in my case the problem was that the store id was not matching with the database tables. After adding them (see above) it works for me. So you have to dig into the error messages and find out where the problem is caused. I updated from 1.9 to 2.1 and think that caused the problems I had. Look if the new orders are added, look which shop id youre using and see if that is in these tables: sequencecreditmemo , sequenceinvoice , sequenceorder , sequenceshipment if not than you have to add them to the database (so sequence_order_0,sequence_order_2, sequence_order_3 etc for the shop id you need.
@hocomadvies the store I am using, it's id is 1 and I see that all of the tables for it are there are they auto increment is setup fine. I did notice one thing. I have another store in there with an id 2 but the tables do not exist for it. This store is not serving any traffic in the front end but I have it hooked up to Amazon and eBay with m2epro. Only store with id 1 is trying to use PayPal flow. Not sure if that is the problem. I can try adding tables for store 2 and try again.
Adding these three tables for store id 2 did not help. Still getting declined errors. I see users have added ways to see exceptions. Is there a way someone can give detailed info on how to debug this, I am fairly new to magento 2 and am having trouble getting the exceptions to try troubleshooting this further. I am hosting this on CentOS 6 with cPanel.
I'm still having the problem on my staging environment with v2.1.3 ... it works fine on my local... I don't get it...
I had the same problem. As soon as I commented out the try/catch block mentioned by @southerncomputer (https://github.com/magento/magento2/issues/6929#issuecomment-263965185), the error message became more precise: "Could not start transaction because there are multiple line items with the same SKU." Has something to do with the Saferpay payment module in my case.
We ran into the same problem as @southerncomputer with a demo shop of ours. In our case the sequence tables for store id 2 were missing, so we added them by running these SQL statements on our database and now we can proceed again through the checkout:
INSERT INTO `sales_sequence_meta`
(`entity_type`, `store_id`, `sequence_table`)
VALUES ('order', 2, 'sequence_order_2'),
('invoice', 2, 'sequence_invoice_2'),
('creditmemo', 2, 'sequence_creditmemo_2'),
('shipment', 2, 'sequence_shipment_2');
CREATE TABLE `sequence_order_2` (
`sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`sequence_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `sequence_invoice_2` (
`sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`sequence_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `sequence_creditmemo_2` (
`sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`sequence_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `sequence_shipment_2` (
`sequence_value` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`sequence_value`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@veloraven people on this thread are having different and unrelated problems with different payment methods. The main issue here is that whatever is going on under the hood is not correctly reported on the front-end. Magento's Checkout\Model\PaymentInformationManagement->savePaymentInformationAndPlaceOrder should be able to capture exceptions thrown by the underlying payment methods and display the correct error to the front-end. At the moment, any request to the Web API is simply thrown back to the customer as a generic 500 error message.
Furthermore, Magento does not provide any way to the payment method to correctly set the error when the API request is made. In other methods such as assignData(), throwing an exception works, however in authorize() and capture() requests, the Web API fails to catch thrown exceptions.
@snez: The first issue you are mentioning is being tracked (and already fixed on the develop branch) over here I think: https://github.com/magento/magento2/issues/6246
Having the same error at check out.
2.1.1, dev server, paypal pro, migration from 1.9
no orders getting placed in database...
Looks like the store ID is 1 based on the admin > store > all stores , and when you hover over the link i see a "1" so I assume store id is 1
See attached, does it matter if my meta_id order is not lined up with the other tables?, seems like the above examples the tables were sorted in correct order as mine are every other store ID from 0 to 1
Really sorry for my ignorance but I'm getting the same issue here. I'm so new to this that I don't even know how you guys are checking the database. What program are you using to verify the database columns? My server is on Ubuntu and I'm very new to linux.
@mattlaltman well you could install phpmyadmin on the server and have a look into the tables there. But before doing that first make a copy of your database :)
@muhupower Hi if I am right the sequence is the key to look at here. If you look at sales_sequence_profile you can see that it goes through the order process step by step. starting by 1 . So your table should look the same as some of the examples above.
Thanks hocomadvies, I tried editing the table to make it look similar to above this.
but I am getting an error
I'm still not able to solve the problem. I created all the missing tables, checked the sales_sequence_meta and -profile tables and added missing entries. No good. It would help a lot knowing the sql queries behind the order placement. Is there a way to catch all of them? Also in our installation the table eav_entity_store is completly empty? Is this table used at all??
Any help is very, very welcome.
@muhupower These two need to match as well!
select * from sales_sequence_meta;
+---------+-------------+----------+-----------------------+ | meta_id | entity_type | store_id | sequence_table | +---------+-------------+----------+-----------------------+ | 1 | order | 0 | sequence_order_0 | | 2 | invoice | 0 | sequence_invoice_0 | | 3 | creditmemo | 0 | sequence_creditmemo_0 | | 4 | shipment | 0 | sequence_shipment_0 | | 5 | rma_item | 0 | sequence_rma_item_0 | | 6 | order | 1 | sequence_order_1 | | 7 | invoice | 1 | sequence_invoice_1 | | 8 | creditmemo | 1 | sequence_creditmemo_1 | | 9 | shipment | 1 | sequence_shipment_1 | | 10 | rma_item | 1 | sequence_rma_item_1 | +---------+-------------+----------+-----------------------+ 10 rows in set (0.00 sec)
mysql> select * from sales_sequence_profile; +------------+---------+--------+--------+-------------+------+------------+---------------+-----------+ | profile_id | meta_id | prefix | suffix | start_value | step | max_value | warning_value | is_active | +------------+---------+--------+--------+-------------+------+------------+---------------+-----------+ | 1 | 1 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 2 | 2 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 3 | 3 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 4 | 4 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 5 | 5 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 6 | 6 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 7 | 7 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 8 | 8 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 9 | 9 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | | 10 | 10 | NULL | NULL | 1 | 1 | 4294967295 | 4294966295 | 1 | |+------------+---------+--------+--------+-------------+------+------------+---------------+-----------+
eav_entity_store is old and is used by some custom modules like cart2quote!
southerncomputer, but I cant make edits to the meta_id to change the order, i get an error
mysql> SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'xxxx' AND REFERENCED_TABLE_NAME = 'sales_sequence_meta'; +------------------------+-------------+------------------------------------------------------------+-----------------------+------------------------+ | TABLE_NAME | COLUMN_NAME | CONSTRAINT_NAME | REFERENCED_TABLE_NAME | REFERENCED_COLUMN_NAME | +------------------------+-------------+------------------------------------------------------------+-----------------------+------------------------+ | sales_sequence_profile | meta_id | SALES_SEQUENCE_PROFILE_META_ID_SALES_SEQUENCE_META_META_ID | sales_sequence_meta | meta_id | +------------------------+-------------+------------------------------------------------------------+-----------------------+------------------------+
you see how there is an order to changing these two tables?
i see, but i have no idea how to do it lol.... can you help? there is no PM feature on gitub.. owen at messtudios dot com is my email
what do your sales_sequence_profile and _meta look like now? you have to add the rows to sales_sequence_profile before adding them to sales_sequence_meta and make sure the meta_id jives between them
try delete * from sales_sequence_profile - changing the order of your sales_sequence_meta to match everyone else then rebuild sales_sequence_meta with the same values! Not sure if the order matters that much!
mysql> select * from store; +----------+---------+------------+----------+-------------------+------------+-----------+ | store_id | code | website_id | group_id | name | sort_order | is_active | +----------+---------+------------+----------+-------------------+------------+-----------+ | 0 | admin | 0 | 0 | Admin | 0 | 1 | | 1 | default | 1 | 1 | Default Storesite | 0 | 1 | +----------+---------+------------+----------+-------------------+------------+-----------+ 2 rows in set (0.00 sec)
you have only 2 stores right?
no there is only 1 store, we migrated from 1.9
what does your select * from store show?
mysql> describe sequence_order_1; +----------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------------+------+-----+---------+----------------+ | sequence_value | int(10) unsigned | NO | PRI | NULL | auto_increment | +----------------+------------------+------+-----+---------+----------------+ 1 row in set (0.00 sec)
mysql> show index from sequence_order_1; +------------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +------------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | sequence_order_1 | 0 | PRIMARY | 1 | sequence_value | A | 426 | NULL | NULL | | BTREE | | | +------------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
when you made sequence_order_1 did you set it up exactly as described above? It doesn't sound like this is your problem!
I never set it up, this was already in the system once we migrated it. So what i have is correct then?
also your keys for meta/profile: mysql> show index from sales_sequence_profile; +------------------------+------------+----------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +------------------------+------------+----------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | sales_sequence_profile | 0 | PRIMARY | 1 | profile_id | A | 10 | NULL | NULL | | BTREE | | | | sales_sequence_profile | 0 | SALES_SEQUENCE_PROFILE_META_ID_PREFIX_SUFFIX | 1 | meta_id | A | 10 | NULL | NULL | | BTREE | | | | sales_sequence_profile | 0 | SALES_SEQUENCE_PROFILE_META_ID_PREFIX_SUFFIX | 2 | prefix | A | 10 | NULL | NULL | YES | BTREE | | | | sales_sequence_profile | 0 | SALES_SEQUENCE_PROFILE_META_ID_PREFIX_SUFFIX | 3 | suffix | A | 10 | NULL | NULL | YES | BTREE | | | +------------------------+------------+----------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ 4 rows in set (0.00 sec)
mysql> show index from sales_sequence_meta; +---------------------+------------+------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +---------------------+------------+------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | sales_sequence_meta | 0 | PRIMARY | 1 | meta_id | A | 10 | NULL | NULL | | BTREE | | | | sales_sequence_meta | 0 | SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID | 1 | entity_type | A | 10 | NULL | NULL | | BTREE | | | | sales_sequence_meta | 0 | SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID | 2 | store_id | A | 10 | NULL | NULL | | BTREE | | | +---------------------+------------+------------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
@muhupower I would say so. What error are you getting when you comment out the code I mentioned originally?
Comment out the exception catcher in vendor/magento/module-checkout/Model/PaymentInformationManagement.php
Then try again, you will see an error show up in your logs in production mode!
For me it was an extension that used a plugin that was calling an undefined variable!
Comment out the TRY { } { catch} but not the $orderId = $this->cartManagement->placeOrder($cartId);
This will expose the underlying error to a tee!
// try { $orderId = $this->cartManagement->placeOrder($cartId); / } catch (\Exception $e) { throw new CouldNotSaveException( __('CNSE1: An error occurred on the server. Please try to place the order again.'.' '.$cartId.$sam.' '.$orderId), $e ); } /
comment out // TRY and / the exception/ code and run it in development mode and see what error you are getting!
Nothing Happens...
I even changed the output of the last letter to says . Please try to place the order agains. with an s at the end, and the error still comes up without the s.
Its like this isn't the correct file or something.
Thanks for you help so far.
are you recompiling and flushing cache/restarting php-fpm/varnish after making those changes?
I made a shell script i run from public_html for production mode:
touch pub/static/deployed_version.txt php bin/magento deploy:mode:set production php bin/magento cache:clean chown -R scw:scw * & service varnish restart & service php-fpm restart & service nginx restart &
or for development mode:
php bin/magento deploy:mode:set developer php bin/magento cache:clean chown -R scw:scw * & service varnish restart & service php-fpm restart & service nginx restart &
hah.. how long is this supposed to take? looks like its stuck on "starting compilation", and the site is down.
Takes a few minutes depending on your speed. I have 50 cores and it still takes a few minutes! since it is single threaded php!
@southerncomputer when I comment out the code, where should I see the exception?
Thanks for all your help... turns out my client fixed it, we were paying with paypal, accepting cc on the website... and it was an internal setting paypal had to change in order to get this to work!
@muhupower can you please share what setting this is?
This is so frustrating. I have not been able to accept any payments on my website for a month now.
I tried commeting out try/catch in vendor/magento/module-checkout/Model/PaymentInformationManagement.php but when I do it does not return any exception.
Any help would be appreciated.
@hubaig, this might help: https://github.com/magento/magento2/issues/6246#issuecomment-258830520
Maybe it helps if you apply the changes they did to the PaymentInformationManagement.php and GuestPaymentInformationManagement.php in that commit. It should then log the actual problem in the exception.log
file.
@hostep Thank you for the reply. I copied the two files and still do not get any exception in var/log/exception.log
Just a little background - I am using Magento ver. 2.1.1, using porto theme and migrated from 1.9.x.
I am unable to place the order in Magento 2.1.1. I don't get specific log details to track the error. The console log shows "Failed to load resource: the server responded with a status of 400 (Bad Request)" at http://example.com/rest/default/V1/guest-carts/36b703a23e05b25a08da0e8ba5ab031f/payment-information
I have previously installed an extension to delete orders. But I removed it too and upgraded setup and cleared cache too. But I can't place order now.
There are no table prefixes either. After setup upgrade, I runned "bin/magento setup:di:compile" command.
Please suggest