Data from Django not loading for other users

Feature(s) impacted

Data (Collections)

Observed behavior

Data is not being loaded for users other than myself (working perfectly for me). A connection error message is shown.

Expected behavior

Data should load normally.

Failure Logs

2024-05-09T02:18:18.070355+00:00 heroku[router]: at=info method=GET path="/forest/authentication/callback?code=3KMQZBFAg8_FdzvF0Z-3qv6pn5ZkIX9eUu72468e_i3zgZZHqRJbp2ITPEI87QrN&state=%7B%22renderingId%22%3A+260146%7D" host=plus-api-d4e75e73088d.herokuapp.com request_id=048cf40b-ee24-43d5-9449-f408b83bbb9d fwd="45.188.128.254" dyno=web.1 connect=0ms service=527ms status=200 bytes=918 protocol=https
2024-05-09T02:18:18.068830+00:00 app[web.1]: 10.1.37.167 - - [09/May/2024:02:18:18 +0000] "GET /forest/authentication/callback?code=3KMQZBFAg8_FdzvF0Z-3qv6pn5ZkIX9eUu72468e_i3zgZZHqRJbp2ITPEI87QrN&state=%7B%22renderingId%22%3A+260146%7D HTTP/1.1" 200 493 "https://app.forestadmin.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
2024-05-09T02:18:18.517207+00:00 app[web.1]: 121124
2024-05-09T02:18:18.517239+00:00 app[web.1]: Traceback (most recent call last):
2024-05-09T02:18:18.517242+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/crud.py", line 68, in dispatch
2024-05-09T02:18:18.517242+00:00 app[web.1]:     return await method(request_collection)
2024-05-09T02:18:18.517242+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.517242+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 104, in wrapped
2024-05-09T02:18:18.517243+00:00 app[web.1]:     return await _check_method(method, self, request, fn)
2024-05-09T02:18:18.517243+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.517244+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 98, in _check_method
2024-05-09T02:18:18.517244+00:00 app[web.1]:     return await decorated_fn(self, request)
2024-05-09T02:18:18.517245+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.517245+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 60, in wrapped2
2024-05-09T02:18:18.517245+00:00 app[web.1]:     return await _authenticate(self, request, fn)
2024-05-09T02:18:18.517245+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.517245+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 55, in _authenticate
2024-05-09T02:18:18.517246+00:00 app[web.1]:     return await decorated_fn(self, request)
2024-05-09T02:18:18.517246+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.517246+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 83, in wrapped1
2024-05-09T02:18:18.517246+00:00 app[web.1]:     return await _authorize(action, self, request, fn)
2024-05-09T02:18:18.517246+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.517246+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 75, in _authorize
2024-05-09T02:18:18.517247+00:00 app[web.1]:     await self.permission.can(request.user, collection, f"{action}")
2024-05-09T02:18:18.517247+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/services/permissions/permission_service.py", line 40, in can
2024-05-09T02:18:18.517247+00:00 app[web.1]:     user_data = await self.get_user_data(caller.user_id)
2024-05-09T02:18:18.517247+00:00 app[web.1]:                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.517247+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/services/permissions/permission_service.py", line 140, in get_user_data
2024-05-09T02:18:18.517248+00:00 app[web.1]:     return self.cache["forest.users"][user_id]
2024-05-09T02:18:18.517248+00:00 app[web.1]:            ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
2024-05-09T02:18:18.517248+00:00 app[web.1]: KeyError: 121124
2024-05-09T02:18:18.517725+00:00 app[web.1]: Internal Server Error: /forest/monolith_venue
2024-05-09T02:18:18.518004+00:00 app[web.1]: 10.1.37.167 - - [09/May/2024:02:18:18 +0000] "GET /forest/monolith_venue?timezone=America%2FGuatemala&fields%5Bmonolith_venue%5D=id%2Cimage%2Cname%2Cdescription%2Cactive%2Ctimestamp&page%5Bnumber%5D=1&page%5Bsize%5D=15&sort=-name HTTP/1.1" 500 69 "https://app.forestadmin.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"




2024-05-09T02:18:18.518579+00:00 heroku[router]: at=info method=GET path="/forest/monolith_venue?timezone=America%2FGuatemala&fields%5Bmonolith_venue%5D=id%2Cimage%2Cname%2Cdescription%2Cactive%2Ctimestamp&page%5Bnumber%5D=1&page%5Bsize%5D=15&sort=-name" host=plus-api-d4e75e73088d.herokuapp.com request_id=2f80a9fb-f833-4769-bccd-7b743800b333 fwd="45.188.128.254" dyno=web.1 connect=0ms service=4ms status=500 bytes=472 protocol=https
2024-05-09T02:18:18.793155+00:00 heroku[router]: at=info method=GET path="/forest/monolith_venue/count?fields%5Bmonolith_venue%5D=id%2Cimage%2Cname%2Cdescription%2Cactive%2Ctimestamp&timezone=America%2FGuatemala" host=plus-api-d4e75e73088d.herokuapp.com request_id=c111ac80-cc53-458c-8db6-6f0e885bbbad fwd="45.188.128.254" dyno=web.1 connect=0ms service=3ms status=500 bytes=472 protocol=https
2024-05-09T02:18:18.791912+00:00 app[web.1]: 121124
2024-05-09T02:18:18.791961+00:00 app[web.1]: Traceback (most recent call last):
2024-05-09T02:18:18.791964+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/crud.py", line 68, in dispatch
2024-05-09T02:18:18.791964+00:00 app[web.1]:     return await method(request_collection)
2024-05-09T02:18:18.791964+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.791965+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 104, in wrapped
2024-05-09T02:18:18.791965+00:00 app[web.1]:     return await _check_method(method, self, request, fn)
2024-05-09T02:18:18.791965+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.791969+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 98, in _check_method
2024-05-09T02:18:18.791969+00:00 app[web.1]:     return await decorated_fn(self, request)
2024-05-09T02:18:18.791970+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.791970+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 60, in wrapped2
2024-05-09T02:18:18.791970+00:00 app[web.1]:     return await _authenticate(self, request, fn)
2024-05-09T02:18:18.791971+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.791971+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 55, in _authenticate
2024-05-09T02:18:18.791971+00:00 app[web.1]:     return await decorated_fn(self, request)
2024-05-09T02:18:18.791971+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.791972+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 83, in wrapped1
2024-05-09T02:18:18.791972+00:00 app[web.1]:     return await _authorize(action, self, request, fn)
2024-05-09T02:18:18.791973+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.791973+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/resources/collections/decorators.py", line 75, in _authorize
2024-05-09T02:18:18.791974+00:00 app[web.1]:     await self.permission.can(request.user, collection, f"{action}")
2024-05-09T02:18:18.791974+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/services/permissions/permission_service.py", line 40, in can
2024-05-09T02:18:18.791974+00:00 app[web.1]:     user_data = await self.get_user_data(caller.user_id)
2024-05-09T02:18:18.791974+00:00 app[web.1]:                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-09T02:18:18.791975+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/forestadmin/agent_toolkit/services/permissions/permission_service.py", line 140, in get_user_data
2024-05-09T02:18:18.791975+00:00 app[web.1]:     return self.cache["forest.users"][user_id]
2024-05-09T02:18:18.791975+00:00 app[web.1]:            ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
2024-05-09T02:18:18.791976+00:00 app[web.1]: KeyError: 121124
2024-05-09T02:18:18.792435+00:00 app[web.1]: Internal Server Error: /forest/monolith_venue/count
2024-05-09T02:18:18.792712+00:00 app[web.1]: 10.1.37.167 - - [09/May/2024:02:18:18 +0000] "GET /forest/monolith_venue/count?fields%5Bmonolith_venue%5D=id%2Cimage%2Cname%2Cdescription%2Cactive%2Ctimestamp&timezone=America%2FGuatemala HTTP/1.1" 500 69 "https://app.forestadmin.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"

Context

  • Project name: Plus
  • Team name: Operations
  • Environment name: Production
  • Agent technology: Django
  • Agent (forest package) name & version: forestadmin-agent-django==1.5.4
  • Database type: Postgres
  • Recent changes made on your end if any: None that would explain the behavior as I am getting no issues.

Hello @0xdesdenova ,

Do you have the issue only on Production or also on your dev environment ?
Can you ensure that you have the right FOREST_ENV_SECRET in your environment variables ?

Kind regards

Thank you @Enki,

I can assure you that the right FOREST_ENV_SECRET is set. I have no issues in both my local and production environments.

On the other hand, my coworker has trouble in the production environment (he only has access to that environment).

It seems that s.he’s trying to access your project with the wrong account (personal gmail instead of […]@plusguatemala.com).

Thank you for your response @Enki.

I removed his personal email account (which he used Google to authenticate) and added the admin email account (email/password combo) thinking it was Google Authentication that was causing the issue. Initially, we observed the same behavior, but it was resolved on its own after one or two days.

I believe the bug is latent. Might be worth looking more into it.