Multiple related fields not visible in production

System Information
  • Strapi Version: v4
  • Operating System: macOS
  • Database: default
  • Node Version: 17.8
  • NPM Version: 8.5.5
  • Yarn Version: 1.22.18

I’ve created a content type which has the relation with two other content types, the app works as expected on local environment, but if deployed once on the server (heroku), I am able to see just one field in the related field section. Can someone please tell that what is the probable reason for so and how to solve this?



Hi try typing this in the search bar example.herokuapp.com/api/contentType?populate=%2A .
Please change contentType to the content type that has a relation with your cost_of_living field .

The reason this fix works is because you have to populate the fields first before you can access the related content type. The documentation explains this here. Good luck.

1 Like

How can I get the data in a component which has a relation to another collection type?
these are the collection fields:


when I try to get the contents via a get call: http://localhost:1337/api/locales1/3?populate=%2A, I get this result:

{
"data": {
"id": 3,
"attributes": {
"GENERAL_Language": "ar",
"GENERAL_region": "EG",
"GENERAL_display_currency": "EGP",
"GENERAL_Twitter_handle": "",
"GENERAL_InnometricsID": "",
"GENERAL_Google_tag_managerID": "",
"Sitemap_XML": "",
"PROMOS_terms_and_conditions_link": "",
"local_id": "ar - EG",
"createdAt": "2022-06-16T02:55:56.204Z",
"updatedAt": "2022-06-16T02:55:56.204Z",
"publishedAt": "2022-06-16T02:55:56.180Z",
"old_cms_id": 3,
"GENERAL_logo": {
"data": null
},
"carriers": {
"data": []
},
"airline_pages": {
"data": []
},
"header_fragment": {
"id": 16
},
"footer_fragment": {
"id": 17
},
"usp_fragment": {
"id": 18
},
"header_amp_fragment": {
"id": 19
},
"footer_amp_fragment": {
"id": 20
},
"usp_amp_fragment": {
"id": 21
}
}
},
"meta": {}
}

here under header_fragment i can get only the id of the, but I want to access all the fields in the header_fragment, how to do that?