Urgent: "Cannot reach your data" Console error - Unexpected error in details view: TypeError: e.getRecord is not a function

Hey Forest Admin Community! I’m implementing a Smart Collection, so far everything’s been a breeze, and I love the documentation! However I’m stuck at getting when trying to view a single record in a smart collection:

Expected behavior

When a single record is clicked, the singe record page should open with record details, etc.

Actual behavior

When I click on a record, I get the “Cannot reach your data” error. The serialized data is being sent from the backend, but somehow the frontend is not able to parse it, I suppose.

The response is very similar to when I load the table and get all records. That works perfectly. The issue is when I click on a single record.

Failure Logs

Console error in browser: Unexpected error in details view: TypeError: e.getRecord is not a function

Context

Accessing single record detail of smart collection

  • Package Version: 6.0.0
  • Express Version: 4.16.3
  • Sequelize Version: 5.15.1
  • Database Dialect: Postgres
  • Database Version: 12
  • Project Name:

Would be great if anyone has any insights on this :slight_smile:

Welcome @akaranath in this community :smiley: !

Could you please share your payload sent by the server when clicking on that record and the full stacktrace the error you have in your browser please :pray:

Thank you for the welcome, @vince!

The request is a GET request to /forest/job_master/07dc6ca0-2e98-48be-8b99-529775399c0b with the following Headers:

GET /forest/job_master/07dc6ca0-2e98-48be-8b99-529775399c0b HTTP/1.1
Host: localhost:3310
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json
Authorization: Bearer <removed>
Origin: http://app.forestadmin.com
Connection: keep-alive
Referer: http://app.forestadmin.com/mitra-admin/Development/Operations/data/bcf742e0-d188-11ea-bd93-cfcb090efd74/index
Pragma: no-cache
Cache-Control: no-cache

And the error stack is:

[forest] 🌳🌳🌳 Unexpected error in details view:  TypeError: e.getRecord is not a function
    M http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:14292
    y http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5482
    v http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5480
    invokeWithOnError http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5003
    flush http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:4995
    flush http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5009
    _end http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5072
    end http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5028
    _run http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5074
    _join http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5073
    join http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:5039
    d http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:3910
    success http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:13826
    u http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:1395
    fireWith http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:1396
    A http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:1679
    r http://app.forestadmin.com/assets/vendor-870628f6ae0d518ac849280db6a1965e.js:1690
vendor-870628f6ae0d518ac849280db6a1965e.js:20904:164

Thanks again for replying so fast! :smiley:

Hey @akaranath, I need the response payload. Sorry if I was not clear enough :sweat_smile:

Oops my bad, @vince :face_with_hand_over_mouth:. Here’s the response payload (I’ve prettified it):

{
  "data": [
    {
      "type": "job_master",
      "id": "07dc6ca0-2e98-48be-8b99-529775399c0b",
      "attributes": {
        "id": "07dc6ca0-2e98-48be-8b99-529775399c0b",
        "role": "Sales",
        "link": null,
        "source": "very",
        "weight": "2",
        "jobCategory": "Sales",
        "shortId": null,
        "unpublishedAt": null,
        "address": null,
        "contactName": "Kemp",
        "contactPhoneNumber": "9811112223",
        "mediaURL": null,
        "latLng": {
          "x": 23,
          "y": 22
        },
        "baseSalary": 24000,
        "maxEarnings": 45000,
        "joiningBonus": 3000,
        "referralBonus": null,
        "benefits": {
          "timings": "8 hours"
        },
        "benefitsMetaData": null,
        "isPartTimeAvailable": true,
        "description": "This is a sample job detail",
        "requirements": {
          "documents": "DL"
        },
        "optionalQuestions": null
      },
      "relationships": {
        "createdByMitra": {
          "data": {
            "type": "mitra",
            "id": "c46f2ba9-1838-45e3-883a-56baca35d9be"
          },
          "links": {
            "related": {
              "href": "/forest/job_master/07dc6ca0-2e98-48be-8b99-529775399c0b/relationships/createdByMitra"
            }
          }
        },
        "company": {
          "data": {
            "type": "company",
            "id": "ff176ba8-c3d0-4ec9-af8f-0c46c24b81da"
          },
          "links": {
            "related": {
              "href": "/forest/job_master/07dc6ca0-2e98-48be-8b99-529775399c0b/relationships/company"
            }
          }
        },
        "city": {
          "data": {
            "type": "city",
            "id": "2ab47e25-6ed0-4d4c-8c65-c45f4307003b"
          },
          "links": {
            "related": {
              "href": "/forest/job_master/07dc6ca0-2e98-48be-8b99-529775399c0b/relationships/city"
            }
          }
        },
        "assignedToMitra": {
          "data": {
            "type": "mitra",
            "id": "c46f2ba9-1838-45e3-883a-56baca35d9be"
          },
          "links": {
            "related": {
              "href": "/forest/job_master/07dc6ca0-2e98-48be-8b99-529775399c0b/relationships/assignedToMitra"
            }
          }
        },
        "locality": {
          "data": {
            "type": "locality",
            "id": "2ee0fc02-7f4b-4d3e-ac0e-2ae3e1f6c81b"
          },
          "links": {
            "related": {
              "href": "/forest/job_master/07dc6ca0-2e98-48be-8b99-529775399c0b/relationships/locality"
            }
          }
        }
      }
    }
  ],
  "included": [
    {
      "type": "customer",
      "id": "c46f2ba9-1838-45e3-883a-56baca35d9be",
      "attributes": {
        "id": "c46f2ba9-1838-45e3-883a-56baca35d9be",
        "name": "Hermit",
        "phoneNumber": "98723247238",
        "photoUrl": null,
        "status": "Active",
        "dateOfJoining": "2020-06-04T13:21:54.484Z",
        "createdAt": "2020-06-04T13:21:54.484Z",
        "updatedAt": "2020-06-04T13:21:54.484Z",
        "deletedAt": null,
        "type": null,
        "latLng": [],
        "assignedToMitraJobCityWorkLocations": [],
        "createdByMitraJobs": []
      },
      "relationships": {}
    },
    {
      "type": "company",
      "id": "ff176ba8-c3d0-4ec9-af8f-0c46c24b81da",
      "attributes": {
        "id": "ff176ba8-c3d0-4ec9-af8f-0c46c24b81da",
        "name": "Crescent Inc",
        "hqAddress": null,
        "contactName": null,
        "contactPhoneNumber": null,
        "createdAt": "2020-03-05T18:37:57.673Z",
        "updatedAt": "2020-03-05T18:37:57.736Z",
        "deletedAt": null,
        "logoUrl": null,
        "jobs": []
      }
    },
    {
      "type": "city",
      "id": "2ab47e25-6ed0-4d4c-8c65-c45f4307003b",
      "attributes": {
        "id": "2ab47e25-6ed0-4d4c-8c65-c45f4307003b",
        "name": "Bengaluru",
        "createdAt": "2020-07-16T09:27:07.563Z",
        "updatedAt": "2020-07-16T09:27:07.563Z",
        "deletedAt": null,
        "photoUrl": null,
        "latLng": [],
        "localities": [],
        "jobCities": [],
        "userLocations": [],
        "userWorkCities": [],
        "pinCodes": []
      }
    },
    {
      "type": "locality",
      "id": "2ee0fc02-7f4b-4d3e-ac0e-2ae3e1f6c81b",
      "attributes": {
        "id": "2ee0fc02-7f4b-4d3e-ac0e-2ae3e1f6c81b",
        "name": "California (Houston)",
        "aliases": null,
        "createdAt": "2020-07-16T09:27:11.447Z",
        "updatedAt": "2020-07-16T09:27:11.447Z",
        "deletedAt": null,
        "latLng": {
          "x": 13.2257,
          "y": 77.575
        },
        "pinCodes": [],
        "jobCityWorkLocations": [],
        "jobCityOnboardingLocations": [],
        "userLocations": [],
        "userWorkLocalities": []
      }
    }
  ]
}

Is there something I’m missing?

@vince I found out what I was doing wrong. I was passing the result list of query to the serializer, instead of just the single object.

So I pass something like resultList[0], and it works perfectly!

Thank you for your help :smiley: