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": "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 />
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.

| improve this answer | |
  • I have already checked to disabled custom and third party module. But not working. – Kirti Nariya Sep 22 '19 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 '19 at 12:49
  • Yes flushed the cache. – Kirti Nariya Sep 22 '19 at 13:25
4

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": "test@test.com",
        "store_id": 1,
        "extension_attributes": {
            "is_subscribed": false
        }
    },
    "password": "Account@123"
}
| improve this answer | |
0

Change method GET to POST Pass Authentication key in header

Authorization: Bearer key
| improve this answer | |
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.

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