Ben Rothe
Ben Rothe

Reputation: 303

What is causing REST API error in Acumatica 2017R2?

I'm receiving the following error when consuming the REST API in Acumatica build 17.207.0029 in my local development environment.

500 Internal Server Error
Object reference not set to an instance of an object.

This exception occurs regardless of which endpoint I try to use. Example endpoints that are failing:

GET /entity/Default/17.200.001/Customer?$expand=MainContact/Address&$filter=MainContact/Email+eq+'johnny@appleseed.com'&$top=1

GET /entity/Default/17.200.001/SalesOrder/$adHocSchema

GET /entity/Default/17.200.001/Shipment/000001?$expand=Packages

All of these REST calls worked fine previously. (I'm using Postman to test the calls.) Login/logout POST calls appear to work fine and return a 204 No Content status code as expected.

Things I've tried so far:

Any ideas?

Stack trace for reference:

{
    "message": "An error has occurred.",
    "exceptionMessage": "Object reference not set to an instance of an object.",
    "exceptionType": "System.NullReferenceException",
    "stackTrace": "   at PX.Data.Process.PXScreenProcessor.HackEtwTrace(Boolean s)\r\n   at PX.Data.Process.PXScreenProcessor.Process(String uri, IPrincipal user, AsyncCallback cb, Action`1 initContext)\r\n   at PX.Api.ScreenUtils.GetScreenInfoWithoutHttpContext(String screenID)\r\n   at PX.Api.ContractBased.EntityExportContextBuilder..ctor(String version, String name, IMetadataProvider metadataProvider, IEntityMappingKeyService entityMappingKeyService, EntityImpl entity, Func`2 screenInfoGetter, ISystemContract systemContract, Boolean returnFullEntities, PXGraph graph)\r\n   at PX.Api.ContractBased.EntityService.GetCustomFieldsSchema(ISystemContract systemContract, String version, String name, EntityImpl entity)\r\n   at PX.Api.ContractBased.Soap.SoapFacadeBase.GetCustomFieldSchemaImpl(Entity entity)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}

Upvotes: 0

Views: 782

Answers (1)

samol518
samol518

Reputation: 1404

This seems like the error that is cause by the .Net framework.

Here is an article on the portal explaining a bit more about this issue: https://portal.acumatica.com/knowledgebase/known-issue-integrations-schedulers-generic-inquiries-using-odata-may-stop-working-on-2017r2-and-2018r1-versions-after-installing-net-framework-4-7-2-build-or-the-latest-windows-update-which-cont/

But to resume it:

Root cause: there is a known issue with compatibility between .Net Framework 4.7.2 build and Acumatica 6.1 (6.10.2515 and older), Acumatica 2017R2 (17.207.0029 and older) and 2018R1 (18.101.0039 and older).

Solution: The problem is fixed in the versions 6.10.2613 and higher, 17.208.0034 and higher and 18.102.0048 and higher.

If you have trouble finding your .Net version I would recommend using the method on the following microsoft docs site: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed

Upvotes: 1

Related Questions