1

I try to register customer via Rest API. But customer registration Rest API throwing error.

Method: POST

Request URL: http://localhost/magento/rest/V1/customers

Body:

{
    "customer": {
        "email": "jdoea@example.com",
        "firstname": "Jane",
        "lastname": "Doe",
        "addresses": [{
            "defaultShipping": true,
            "defaultBilling": true,
            "firstname": "Jane",
            "lastname": "Doe",
            "region": {
                "regionCode": "NY",
                "region": "New York",
        "regionId":43
            },
            "postcode": "10755",
            "street": ["123 Oak Ave"],
            "city": "Purchase",
            "telephone": "512-555-1111",
            "countryId": "US"
        }]
    },
    "password": "test@$123"
}

Response:

    <br />
<b>Fatal error</b>: Allowed memory size of 805306368 bytes exhausted (tried to allocate 20480 bytes) in
<b>/var/www/html/magento/vendor/magento/module-store/Model/StoreRepository.php</b> on line <b>74</b><br />
2

From my experience this kind of error is related to a recursive method that it calls upon itself in an infinite loop.

I would suggest to check the newest changes made to the project or the latest modules installed.

  • I have already checked to disabled custom and third party module. But not working. – Kirti Nariya Sep 22 at 11:42
  • did you also cleared the cache? if you are using redis, try to connect to the server and a FLUSHALL command. – bluscience Sep 22 at 12:49
  • Yes flushed the cache. – Kirti Nariya Sep 22 at 13:25
0

Change method GET to POST Pass Authentication key in header

Authorization: Bearer key
0

You can still use xdebug in Magento 2, but it will require modifying the default max_nesting_level value of 100 that xdebug uses.

Open up the php.ini file being used by your server and update or add the following config, depending on if it already exists in your file:

xdebug.max_nesting_level = 320

This works for me, but if you still see the error you can try doubling the value again.

  • Not working I have tried with value 450 and then 1000 – Kirti Nariya Sep 20 at 7:28
  • This is server related issue, try to increase space, execution time, memory limit etc at server level – Oscprofessionals Sep 20 at 7:48
  • I am working in my local instance. Also this API working fine in native Magento 2 instance. It is issue in my this project instance only. – Kirti Nariya Sep 20 at 9:07
  • This is all about server problem, whether you are on local or instance. – Oscprofessionals Sep 20 at 14:17
  • Yes. But how we can resolve. – Kirti Nariya Sep 23 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.