+ Start a Discussion
Mauricio OliveiraMauricio Oliveira 

Errors after test is over when "entering managed package"

Hi everyone,

I started having some errors recently on my production environment and can't figure out what is going on. This is happening in a few test classes I run and by looking at the debug logs, all the tests go through everything as expected and after they are done and call test.stopTest(), the test enters managed package and things go bad. This is actually happening when entering Zendesk package, but I'm not sure if this is related to this specific package (could be some error that was being forwarded and ends up on last package or something like that).

The first thing I got was this:
Error MessageSystem.QueryException: No such column 'BillingAddress' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Stack Trace(Zendesk)
I don't make such query, Zendesk was making it when entering managed packages and doing a query with all fields of Account object. I don't know why that fails too, since "BillingAddress" does exist on Account object. Anyway, I was able to reproduce this first error on my Sandbox and commented the single test that makes this happen.

However, there was another error happening in other test classes, a NullPointerException also after the test.stopTest() is called on my test classes, then it enters managed package. This one I couldn't reproduce in sandbox, it just happens on production. These are the last lines of the debug logs for running one of the failing test classes.

08:42:07.956 (1956485495)|CODE_UNIT_FINISHED|testClass.geraDolares
08:42:07.956 (1956492660)|EXECUTION_FINISHED
08:42:07.957 (1957175690)|ENTERING_MANAGED_PKG|Zendesk
08:42:07.975 (1975110468)|SOQL_EXECUTE_BEGIN|[238]|Aggregations:0|SELECT RM_Account_Name__c,Account_Which_software__c,Phone,Jigsaw,Zendesk__Tags__c,ANSYS_Customer_Name__c,Knowledge_about_ESSS_products_ACCOUNT__c,Zendesk__Notes__c,ParentId,At_which_frequency_ACCOUNT__c,Type,CreatedById,LastActivityDate,Level_of_knowledge_ACCOUNT__c,Already_ANSYS_Customer__c,sfcloud__Segment__c,BillingCity,Description,IsDeleted,Account_city__c,Industry,SystemModstamp,Zendesk__Domain_Mapping__c,Fax,Zendesk__Zendesk_oldTags__c,TickerSymbol,Already_have_some_CAE_system_ACCOUNT__c,Account_zip_postal_code__c,ShippingCity,AnnualRevenue,ShippingState,BillingPostalCode,CreatedDate,JigsawCompanyId,OwnerId,Do_you_buy_CAE_services_ACCOUNT__c,ANSYS_ASC__c,Zendesk__Last_Sync_Date__c,Already_bought_services_ESSS_ACCOUNT__c,Ownership,ANSYS_Industry_group__c,Already_have_some_CAD_System_ACCOUNT__c,NumberOfEmployees,ShippingPostalCode,CNPJ__c,Zendesk__Last_Sync_Status__c,LastModifiedById,SicDesc,CurrencyIsoCode,Account_street__c,AccountSource,ANSYS_Customer_number__c,Does_your_company_have_R_D_ACCOUNT__c,Account_Sector__c,BillingState,BillingCountry,LastModifiedDate,Id,Account_Industry__c,On_Which_Technology__c,Account_state_province__c,Name,ShippingStreet,Major_Account__c,AccountNumber,Services_provider_ACCOUNT__c,Account_country__c,Zendesk__Zendesk_OutofSync__c,Site,Zendesk__Result__c,Sic,Account_Duplicate_Test__c,Website,MasterRecordId,ShippingCountry,Zendesk__Zendesk_Organization__c,BillingStreet,Zendesk__createdUpdatedFlag__c,RM_Account_Code__c,Region__c,ANSYS_Industry_subgroup__c,Zendesk__Zendesk_Organization_Id__c,Rating,ANSYS_SIC__c FROM Account Where id =: accId
08:42:07.982 (1982778015)|SOQL_EXECUTE_END|[238]|Rows:1
08:42:07.983 (1983511273)|SOQL_EXECUTE_BEGIN|[119]|Aggregations:0|select ownerid, Zendesk__Result__c, Zendesk__Zendesk_OutofSync__c, Zendesk__Zendesk_oldTags__c, Zendesk__createdUpdatedFlag__c, id, name from Account where id = :tmpVar1
08:42:07.989 (1989252932)|SOQL_EXECUTE_END|[119]|Rows:1
08:42:08.083 (2083512860)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

(Zendesk)

08:42:08.083 (2083533104)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

(Zendesk)

I already opened a ticket on Zendesk support, but haven't received an answer yet, and since this is blocking me from deploying things, I decided to try developer forums, maybe someone had the same or similar issue and can give me some hint.

Any ideas?

Regards.


Best Answer chosen by Mauricio Oliveira
Mauricio OliveiraMauricio Oliveira
Just in case someone faces this problem too, it is something with Zendesk package. Zendesk support just replied me informing that this is a known issue they are working on. A workaround is to disable the ongoing sync between Salesforce and Zendesk. I'm doing this for when I need to deploy something to production (can't deploy anything if tests fail).

All Answers

Vinit_KumarVinit_Kumar
In the SOQL query above I do not see BillingAddress being queried.The way I would approach is to narrow down which test class is actually failing in production by running the individual test in production.

After identifying the same,I would go ahead and look into debug logs ..

Hope this helps !!
Mauricio OliveiraMauricio Oliveira
Thanks for the reply, but those are two different errors. This was the output in debug logs for the BillingAddress issue:

09:49:43.665 (10665133080)|ENTERING_MANAGED_PKG|Zendesk
09:49:43.732 (10732239404)|SOQL_EXECUTE_BEGIN|[238]|Aggregations:0|SELECT RM_Account_Name__c,Account_Which_software__c,Phone,Jigsaw,Zendesk__Tags__c,ANSYS_Customer_Name__c,Zendesk__Notes__c,Knowledge_about_ESSS_products_ACCOUNT__c,ParentId,BillingAddress,At_which_frequency_ACCOUNT__c,Type,CreatedById,LastActivityDate,Level_of_knowledge_ACCOUNT__c,Already_ANSYS_Customer__c,sfcloud__Segment__c,BillingCity,Description,IsDeleted,Account_city__c,Industry,SystemModstamp,Zendesk__Domain_Mapping__c,pw_cc__BillingAddressStatus__c,Fax,Zendesk__Zendesk_oldTags__c,TickerSymbol,Already_have_some_CAE_system_ACCOUNT__c,Account_zip_postal_code__c,ShippingCity,ShippingState,BillingPostalCode,AnnualRevenue,CreatedDate,JigsawCompanyId,OwnerId,Do_you_buy_CAE_services_ACCOUNT__c,LastViewedDate,ANSYS_ASC__c,Zendesk__Last_Sync_Date__c,Already_bought_services_ESSS_ACCOUNT__c,Ownership,ANSYS_Industry_group__c,Already_have_some_CAD_System_ACCOUNT__c,NumberOfEmployees,ShippingPostalCode,CNPJ__c,Zendesk__Last_Sync_Status__c,LastModifiedById,SicDesc,pw_cc__ShippingAddressStatus__c,CurrencyIsoCode,Account_street__c,AccountSource,ANSYS_Customer_number__c,Does_your_company_have_R_D_ACCOUNT__c,Account_Sector__c,BillingState,BillingCountry,LastModifiedDate,Id,Account_Industry__c,On_Which_Technology__c,Account_state_province__c,ShippingStreet,Name,Major_Account__c,AccountNumber,Services_provider_ACCOUNT__c,Account_country__c,Zendesk__Zendesk_OutofSync__c,Site,ShippingAddress,Zendesk__Result__c,Sic,Account_Duplicate_Test__c,Website,MasterRecordId,ShippingCountry,Zendesk__Zendesk_Organization__c,BillingStreet,Zendesk__createdUpdatedFlag__c,RM_Account_Code__c,Region__c,ANSYS_Industry_subgroup__c,Zendesk__Zendesk_Organization_Id__c,Rating,ANSYS_SIC__c FROM Account Where id =: accId
09:49:43.735 (10735429861)|SYSTEM_METHOD_EXIT|[125]|system.Test.stopTest()
09:49:43.735 (10735444326)|SYSTEM_MODE_EXIT|false
09:49:43.735 (10735477670)|FATAL_ERROR|System.QueryException: No such column 'BillingAddress' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

(Zendesk)
09:49:43.735 (10735492140)|FATAL_ERROR|System.QueryException: No such column 'BillingAddress' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

(Zendesk)

You can see that it is being queried. But this error I was able to reproduce in sandbox and find out whith exact test was causing this (even that I couldn't figure out why exactly it was happening), but this error I can ignore for now. The other error (with NullPointerException at the end) is still not solved and I can't reproduce on sandbox.

Also I can't find the individual test causing this other one. There are several test classes with this problem, and each test class has a few test methods failing. And as I said, I don't see any type of error or exception during execution of my test, this error is happening after the last line of my test is executed and Salesforce enters managed packages. Anyway, I can't comment/remove tests since they are in production (thus not editable). Or is there any way to run specific tests in a test class in production?

Does someone have another idea? I'd greatly appreciate any help, thanks in advance!
Mauricio OliveiraMauricio Oliveira
Just in case someone faces this problem too, it is something with Zendesk package. Zendesk support just replied me informing that this is a known issue they are working on. A workaround is to disable the ongoing sync between Salesforce and Zendesk. I'm doing this for when I need to deploy something to production (can't deploy anything if tests fail).
This was selected as the best answer