Problem with creating EmailAddress object using API

We have an integration system between the web site and SuiteCRM. When people submit contact form on web site our integration system creates opportunities and other SuiteCRM objects. That system worked well for a reasonably long time but recently we started to get a strange problem with SuiteCRM API call which creates EmailAddress object on our live server. API call is very simple. Authenticated POST request is sent to SuiteCRM url https://server.url/api/V8/module with data like that:


{
	"data": {
		"type":"EmailAddresses",
		"attributes":{"email_address":"email.address@gmail.com"}
	}
}
	
And we are getting back result which looks like a success:
{
    "data": {
        "type": "EmailAddress",
        "id": "d225ffca-e389-0863-76f8-624e50a8fe99",
        "attributes": [],
        "relationships": []
    }
}

but later when we try to add a relationship with that EmailAddress object we are getting back an error:
{
    "errors": {
        "status": 400,
        "title": null,
        "detail": "EmailAddresses module with id d225ffca-e389-0863-76f8-624e50a8fe99 is not found"
    }
}

We later checked and can confirm that no entry in email_addresses table with provided email address and/or returned id was created. 

Exactly the same API calls still work properly on our dev SuiteCRM server although response from the first API call looks a bit different:
{
    "data": {
        "type": "EmailAddress",
        "id": "ebc13eb1-fa22-8f58-8646-624e2ebf2bca",
        "attributes": {
            "email_address": "email.address@gmail.com",
            "email_address_caps": "",
            "invalid_email": 0,
            "opt_out": 0,
            "confirm_opt_in": "not-opt-in",
            "confirm_opt_in_date": "",
            "confirm_opt_in_sent_date": "",
            "confirm_opt_in_fail_date": "",
            "confirm_opt_in_token": "",
            "date_created": "",
            "date_modified": "2022-04-07T00:21:00+10:00",
            "deleted": 0
        },
        "relationships": []
    }
}

Both live and dev servers use the same SuiteCRM Version 7.11.18, Sugar Version 6.5.25 (Build 344) and are hosted on Windows server with SQL Server database.

How we can troubleshoot that problem? We tried to run SuiteCRM quick repair which didn’t help. We also found the following errors in SuiteCRM log: “Filter field email_address in EmailAddress module is not found” which may be related to the problem but not sure what does it mean.

We found a reason for that problem. I believe it was cased by a short period when disk on the server becomes full. It resulted in corrupted /cache/modules/EmailAddresses/EmailAddressvardefs.php file. In fact it becomes 0 bytes in size. After we replaced that file from corresponding file taken from dev server our integration process started to work properly again. Quick repair process didn’t fix that problem but probably there are other “repair” scripts in SuiteCRM which would do it.
In any case that information might help someone to troubleshoot other problems when SuiteCRM behaves in a strange way.

1 Like