You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeError: Cannot read properties of undefined (reading 'endSession') #4133
I encountered the error in the following situation: edit of a collection item (Timecards collection) with the following access function for create & edit:
Basically i have the following collections:
users: admin or developers, developers must be able to login and create/view/edit their own timecards
clients
projects
timecard: submitted by devs, here i am using the access function and this is the place where i get the error when i try to edit an existing timecard. Actually i am not able to edit the timecard at all, i think it is related to the issue.
i also created another access function (isAdminOrDeveloper) where i was able to implement a workaround but it involves querying the db with the local api
To Reproduce
clone repo, setup .env file with mongodbatlas db or a local mongodb
yarn dev and create admin
create developer user from admin panel
create a client and a project from the admin panel
logout and login with dev account
create timecard with dev account
try to edit timecard with dev account -> get error
I am running into the same error message for similar cases in several of my collections. After some testing, it seems like it triggers on field access functions if one field has more than a single access function, or if two or more fields have one or more access functions. I'm using the MongoDB adapter. It looks like the transaction is being shut down prematurely.
Here is example code to explain when the error triggers in my app:
Getting this same error with v2.1.1. Reverting to v2.1.0 fixes the issue.
2.1.0 fixes it thanks!
@peterskeide explains it perfectly. With one field access it works, with more than one I get this error:
and all the fields of the collections become readonly / uneditable.
Commenting again to add that I don't have any field-level access checks, but I do have multiple (create, read, update, delete) collection-level access checks.
Activity
peterskeide commentedon Nov 15, 2023
I am running into the same error message for similar cases in several of my collections. After some testing, it seems like it triggers on field access functions if one field has more than a single access function, or if two or more fields have one or more access functions. I'm using the MongoDB adapter. It looks like the transaction is being shut down prematurely.
Here is example code to explain when the error triggers in my app:
revnelson commentedon Nov 15, 2023
Getting this same error with v2.1.1. Reverting to v2.1.0 fixes the issue.
billyhawkes commentedon Nov 16, 2023
2.1.0 fixes it thanks!
@peterskeide explains it perfectly. With one field access it works, with more than one I get this error:

and all the fields of the collections become readonly / uneditable.
revnelson commentedon Nov 17, 2023
Commenting again to add that I don't have any field-level access checks, but I do have multiple (create, read, update, delete) collection-level access checks.
jasperverbeet commentedon Nov 20, 2023
Same issue here. This only happens when there are field level access control checks on the collection.
revnelson commentedon Nov 30, 2023
Can confirm, I'm still having unauthorized issues with 2.2.2. Staying at 2.1.0 is the only solution so far that I'm aware of.
DanRibbens commentedon Jul 22, 2024
I'm closing this as it has become stale. Tag me if this is still an issue and we can re-open it.
github-actions commentedon Sep 7, 2024
This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.