function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Siddardha Jonnalagadda 4Siddardha Jonnalagadda 4 

Uncaught Error in $A.getCallback() [Cannot read property 'bizArray' of null]

I am trying to execute the following code but its trowing me a errror please help me out.

InTheArea Apex class

public class InTheArea {
        public static String getLocal (String searchTerm, Decimal lat, Decimal lon) {
        String url = '' + lat +','+ lon + '&term=' + EncodingUtil.urlEncode(searchTerm, 'UTF-8');
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        HTTPResponse res = http.send(req);
        return res.getBody();   

<aura:component controller="InTheArea" implements="force:appHostable, flexipage:availableForAllPageTypes, flexipage:availableForRecordHome, force:hasRecordId" access="global" >
<aura:attribute name="defaultSearch" type="String" default="Restaurants" />
<aura:attribute name="location" type="Object" default='{"coords":{"latitude":37.7938462, "longitude":-122.3970253}}' />
<aura:attribute name="restaurantList" type="Object" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<div class="slds">
  <div class="slds-box" aura:id="main">
    <div aura:id="panelList">
        <h2 class="slds-text-heading--small slds-m-bottom--small">In the Area</h2>
        <div class="slds-form-element">
          <label class="slds-form-element__label slds-assistive-text" for="searchBox">Search</label>
          <div class="slds-form-element__control">
              <ui:inputText aura:id="searchTerm" label="" class="field" placeholder="Search for..." change="{!c.updateSearch}" />
      <div aura:id="scrollableArea">
        <ul class="slds-list--vertical slds-has-dividers--top-space">
          <li class="slds-list__item">
              <h3 class="slds-text-heading--small slds-m-bottom--x-small">Item 1</h3>
          <li class="slds-list__item">
              <h3 class="slds-text-heading--small slds-m-bottom--x-small">Item 2</h3>
          <li class="slds-list__item">
              <h3 class="slds-text-heading--small slds-m-bottom--x-small">Item 3</h3>


    doInit : function(component, event, helper) {


    getLocalList: function(component) {
        var searchTerm = component.get("v.defaultSearch");
        var location = component.get("v.location");
        var action = component.get("c.getLocal");
        location = JSON.parse(location);
            "searchTerm": searchTerm,
            "lat": location.coords.latitude,
            "lon": location.coords.longitude
        action.setCallback(this, function(response) {
            this.doLayout(response, component);
    // add doLayout function
    doLayout: function(response, component) {
        var data = JSON.parse(response.getReturnValue());
        component.set("v.restaurantList", data.bizArray);
        console.log("The Data: ", data);

Uncaught Error in $A.getCallback() [Cannot read property 'bizArray' of null]
Callback failed: apex://InTheArea/ACTION$getLocal
throws at
Shashwat NandanShashwat Nandan
Hi Siddardha,

Check the logs if you're getting System.CalloutException: Unauthorized endpoint message in the logs. Your remote site settings might not be correctly configured.