3

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": "[email protected]",
        "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 />

4 Answers 4

3

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.

3
  • I have already checked to disabled custom and third party module. But not working. Sep 22, 2019 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, 2019 at 12:49
  • Yes flushed the cache. Sep 22, 2019 at 13:25
5

In case of anyone wondering, I've had the exact same issue in my Magento 2.3.5 multisite setup when calling the /rest/V1/customers REST endpoint.

I've solved the issue by specifying the store_id parameter in my customer object:

{
    "customer": {
        "firstname": "test",
        "lastname": "test",
        "email": "[email protected]",
        "store_id": 1,
        "extension_attributes": {
            "is_subscribed": false
        }
    },
    "password": "Account@123"
}
0

Change method GET to POST Pass Authentication key in header

Authorization: Bearer key
3
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.

5
  • Not working I have tried with value 450 and then 1000 Sep 20, 2019 at 7:28
  • This is server related issue, try to increase space, execution time, memory limit etc at server level Sep 20, 2019 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. Sep 20, 2019 at 9:07
  • This is all about server problem, whether you are on local or instance. Sep 20, 2019 at 14:17
  • Yes. But how we can resolve. Sep 23, 2019 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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