Collection does not display

I have a collection in my local environment that does not display in the Forest Admin UI. I get the “Cannot reach your data” message. When I inspect the network traffic there is data coming back from my backend. The collection count also displays correctly in the UI. There are no errors in my server logs and none in the browser console. I have done a quick troubleshooting session with @louis. We have verified that the UI does receive updates from my server (we removed an action which was picked up by the UI). We have tried to simplify the model by removing an association (which was also picked up by the UI). Neither of those steps resulted in any change to the problem.

Expected behavior

Should display collection
Please describe here the behavior you are expecting.

Actual behavior

What is the current behavior?
Displays “Cannot reach data” message

Failure Logs

None
Please include any relevant log snippets, if necessary.

Context

Please provide any relevant information about your setup.
“forest-express”: “^7.10.0”,
“forest-express-sequelize”: “^6.7.7”,
“sequelize”: “^6.5.0”,
“sequelize-cli”: “^6.2.0”,
“express”: “^4.16.3”,

  • Database Dialect: mysql
  • Database Version: 5.7.24
  • Project Name: Woodpecker

I should note that when I delete the 113,000 records from the table and instead just upload 89 records. Those 89 records are displayed as expected. This leads me to believe that it is an issue with the number of records in this table.

Hello @Andrew_Prior

Sorry to hear about this issue.

Can you check the network tab of your browser developper tools? If this is indeed related to the quantity of data, you might find a timeout or something similar for some request.
Please look for call on routes like /forest/abc and /forest/abc/count (with “abc” you collection name).

You can also start your Forest agent with DEBUG=sequelize* npm start to display the queries and their execution time.
(DEBUG=* npm start will give you more logs if needed)

Thank you

Thank you for your response. In my network tab the calls to get data from the collection are not timing out, they are return data as expected. The data is just not getting displayed. Please sync with @louis. He has a video of troubleshooting session that shows this.

Hi @Andrew_Prior :wave:

Could you please check the response on the getAll request of this collection and verify that all your records have an “id” field (And that this id also has a value)?

This is a mandatory field for a collection to work and it can definitely cause issues if this requirement is not met.

Let me know if that helps :pray:

@jeffladiray Does the model have to have a primary key that is named id? Because if that is required then that is the issue. I have a primary key that is named file_key instead of id.

To give a more explicit response:

The id field is not required on your model - we are able to detect which one of your field is the primary key, and our serialization process will duplicate your primary key (In order to have both id & your primary key sent back to our frontend).

In the video, I can see that the first record of the GET /forest/yourModel has an id: "", which is the source of the issue you are experiencing (I’m able to reproduce the issue with a similar setup, which should clearly display a better log for this case).

2 Likes

Yes, once I removed that record it start to display correctly. Thank you!

2 Likes