Error when fetching data from Django instance on Heroku

Feature(s) impacted

Data from my Django instance is not being loaded properly.

Observed behavior

The following error is presented on the screen where I would expect to see my instance’s data:

The request to your server either failed or returned invalid data. Please check your console logs to get more information.

And this is logged to the console:

{“errors”: [{“detail”: “list index out of range”}]}

Expected behavior

I expect to see my data as I do in other projects.

Failure Logs

2023-07-31T11:10:34.756813+00:00 app[web.1]: Bad Request: /forest/users_user

2023-07-31T11:10:34.757144+00:00 app[web.1]: 10.1.90.107 - - [31/Jul/2023:11:10:34 +0000] “GET /forest/users_user?timezone=Europe%2FCopenhagen&fields%5Busers_user%5D=id%2Creferral_code%2Cemail%2Cname%2Cimage%2Cactive%2Ctimestamp&page%5Bnumber%5D=1&page%5Bsize%5D=15&sort=-email HTTP/1.1” 400 51 “https://app.forestadmin.com/” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36”

2023-07-31T11:10:34.753050+00:00 heroku[router]: at=info method=GET path=“/forest/users_user?timezone=Europe%2FCopenhagen&fields%5Busers_user%5D=id%2Creferral_code%2Cemail%2Cname%2Cimage%2Cactive%2Ctimestamp&page%5Bnumber%5D=1&page%5Bsize%5D=15&sort=-email” host=aldous-api-1bade937176c.herokuapp.com request_id=1f273ebb-7ced-48e5-85d1-40741a5b10b8 fwd=“185.103.121.178” dyno=web.1 connect=2ms service=12ms status=400 bytes=444 protocol=https

2023-07-31T11:10:34.805974+00:00 heroku[router]: at=info method=GET path=“/forest/users_user/count?fields%5Busers_user%5D=id%2Creferral_code%2Cemail%2Cname%2Cimage%2Cactive%2Ctimestamp&timezone=Europe%2FCopenhagen” host=aldous-api-1bade937176c.herokuapp.com request_id=85608198-5fb1-466d-ad1d-d03b5bd28030 fwd=“185.103.121.178” dyno=web.1 connect=1ms service=13ms status=400 bytes=444 protocol=https

2023-07-31T11:10:34.809789+00:00 app[web.1]: Bad Request: /forest/users_user/count

2023-07-31T11:10:34.810115+00:00 app[web.1]: 10.1.32.209 - - [31/Jul/2023:11:10:34 +0000] “GET /forest/users_user/count?fields%5Busers_user%5D=id%2Creferral_code%2Cemail%2Cname%2Cimage%2Cactive%2Ctimestamp&timezone=Europe%2FCopenhagen HTTP/1.1” 400 51 “https://app.forestadmin.com/” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36”

Context

  • Project name: Aldous
  • Team name: Operations
  • Environment name: Production
  • Agent (forest package) name & version: django-forestadmin==1.5.0
  • Database type: Postgres
  • Recent changes made on your end if any: Changes to RestApi views. Nothing to do with DB, and my API is working fine as well as ForestAdmin running locally.

Hi @0xdesdenova,
We recently added some logs in the agent in case of error raised before returning an error http response. Could you update your agent to version 1.6.2 or later and share the stack trace that shows your error?

Best regards.

Hello! I apologize for the late reply. I took some days off.

Here is the precise error:

{
    "errors": [
        {
            "detail": "float() argument must be a string or a real number, not 'datetime.timedelta'"
        }
    ]
}

Hello,
I hope you had good vacations.

For your bug, I don’t understand the link between errors “list index out of range”, and “float argument must be str not timedelta”. Are the 2 error messages link to the same bug ?

If possible, could you:

  • Update to the latest version of django-forestadmin (1.6.8 for now),
  • Share with us the stacktrace that appears on your django project,
  • Tell us how to reproduce this error (which action crashes, on which type of field, … or any other information that might help us)?

PS : I see in your HTTP request you have a timestamp field in your users_user collection, what is the type of this field (integer, datetime) ?

Best regards.

Thank you. I figured it out. It was due to a Duration field. It is not a complete DateTime, hence the issue. I have since changed it and the problem was resolved!