I have been working on migrating our forestadmin app from a legacy django-forestadmin agent to the newer forestadmin-agent-django. During the migration process, I have encountered this datasourcetooklitexception which seems to be a newer part of the agent.
Expected behavior
I am expecting the data to be loaded without such exceptions.
Thanks for your message and welcome to our community
An hardcoded id could make this error, but I just checked and I’m able to create a model with a primary key not named id.
Can you share with us the HTTP request (and it’s parameters) that generate this error ?
Do you have any customizations on the agent side related to your patient collection ?
Hi,
Your HTTP request is asking the field id that doesn’t exist in you collection patient; that is the source of the issue.
Could you:
Copy as curl the request you just share with us and modify &fields%5Bpatient_id%5D=id by &fields%5Bpatient_id%5D=patient_id and share with us the result or stacktrace this new request generate?
Could you try to onboard your django project on a new empty forest project without existing customization and tell us if you face the same issue?
Which makes me think if there’s any issue with authentication. I can log in to forestadmin normally; then in the UI I can see that the request failed for some tables. For some tables, the request does go through and I get a 200.
With that being said, we used to use the get_token function from django_forest.utils(old agent) to request middleware. Is there an equivalent function to that in the new agent? Or did anything change there(e.g. encoding algorithm)?
I will be out of office for the next couple of weeks. So I will circle back after that.
Hi,
I expected an error, but not an authentication error.
For your requests that are not working, is it the same error that occurred in your project (column not found collection.unknown_field)?
The get_token function doesn’t exist anymore, instead in all custom function called by the agent, there is a context parameter which contain a caller attribute which is the user decoded as the same way of get_token. Here is an example when using hooks, context.caller is an User object.
We’re still interesting to know if this error appear on a new and empty forest project.
Hi @julien.barreau Sorry for the late reply. I got pulled away to other projects. Unfortunately, I haven’t had the time to implement the solution you mentioned. I will try to do that next week. When I do, I will let you know.
Hello @naquib, hope you’re well! Do you have some time next week to adress this issue with @julien.barreau during a tech session? We’ll close this thread in the meantime.