Getting this error when createCustomer mutation from graphql api (Some transactions have not been committed or rolled back)

magento.stackexchange https://magento.stackexchange.com/questions/292176

  •  15-03-2021
  •  | 
  •  

Question

I am getting this error when i try createCustomer mutation from graphql api searched for solution for this error but reached nothing i even tried to debug the code of module-customer-graph-ql in vendor by trying to log some variables values in system.log and got nothing from those variables trying to get their values , All i knew is that the error is coming from Magento\Customer\Api\AccountManagementInterface at this line
$customer = $this->accountManagement->createAccount($customerDataObject, $password); Have been trying to know what is wrong with this part of the code but found nothing, i will also mention that createcustomer mutation is working fine on the localhost on my pc but on the server it is giving me that mysterious error and also giving me server error on createCustomerToken mutation , But all functionality is working well in the front website of magento in the browser , magento version is magento2.3.2 on server and localhost

example mutation i am using for createCustomer

mutation{
  createCustomer(input: {
    firstname: "john"
    lastname: "doe"
    email: "john@doe.com"
    password: "!234Qwer"        
  }){
    customer{
      email
    }
  }
}

error is here

{ "error": {}, "text": "{\"errors\":[{\"message\":\"Internal server error\",\"category\":\"internal\",\"locations\":[{\"line\":2,\"column\":3}],\"path\":[\"createCustomer\"]}],\"data\":{\"createCustomer\":null}}\nFatal error: Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /home/admin/web/mywebsite/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3981 in /home/admin/web/mywebsite/public_html/vendor/magento/framework/App/ErrorHandler.php:61\nStack trace:\n#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(256, 'Some transactio...', '/home/admin/web...', 3981, Array)\n#1 /home/admin/web/mywebsite/public_html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(3981): trigger_error('Some transactio...', 256)\n#2 [internal function]: Magento\Framework\DB\Adapter\Pdo\Mysql->__destruct()\n#3 {main}\n thrown in /home/admin/web/mywebsite/public_html/vendor/magento/framework/App/ErrorHandler.php on line 61
\n" }

Was it helpful?

Solution

I found solution for my problem, for createCustomer mutation , all i had to do to get it back working was to reset customer_grid index and reindex

php bin/magento indexer:reset customer_grid
php bin/magento indexer:reindex

so these two commands solved creating customer error.

another problem that i had was login customer "generateCustomerToken" mutation , it gave me server error and i tried to log variables to find the real error but i found that nothing was logged, i tried to use rest api of magento to login user by sending post request to this endpoint {base_url}/rest/V1/integration/customer/token so i found an error in the login rest api response and this time it was clear , the problem was with a custom module that does not have configuration for it to work yet, this module gave me this error so i disabled it and all is working now

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top