-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error TypeError: Cannot read property '_id' of undefined #6640
Comments
Not sure where you got Strapi v1.0.0 but that version hasn't been supported in over 3 years and was built before the Alpha. |
@derrickmehaffy Sorry for that, the version is the last RC, the v3.0.0 |
That honestly looks like you have some miss-matched versions or something odd going on with your db |
Just a question, I jumped from beta 26 to RC 3.0.0. In that case, I have just to use strapi@beta for the installation? I was searching for a newest one but I did not find anything |
I found the, I was running my Docker with an old version of Node. Thank you |
I am getting the same error, but I did not upgrade anything. I am still running on v3.0.0-beta.20 since it was released. Interestingly everything works in dev (Ubuntu 16 LTS, Node 12.18.1), but not in production (Docker container with node:12.8.0-alpine). @PhantomxJoker Which version of Node did you use in your container to make it work? |
Hi @hendrikgaffo ! I'm using the same version as you, but with the change I made a clean build too (using npm run build --clean). Not sure if did the trick, but worked for me |
the same error, on strapi the same 3.0.5, in my mongodb user-permission-permission table, some data without role, so dbPermissions.map err |
Thanks for the hint @weilaiqishi ... We resolved this by removing the document from MONGODB without role! But this should not happen again, observation was that when a route and controller gets edited inthe project directory, it throws this issue. Route and controller files should be replaced as a whole when promoting code from one env to another. |
Thankyou!! |
Just ran into this out of nowhere... didn't even need to reset my db to get across it. |
I encountered this issue today on version 3.5.3 when I was editing routes and controllers on my local instance. Deleting the records in user-permission-permission with empty role has resolved the issue. Thanks @basavarajdodamani |
We have encountered this issue many times on our live server. It just happens out of nothing. It's very time-consuming to delete and re-do everything (a lot of tables to re-do all the permissions) + it shouldn't really crash the live server. Does anyone have any solution? This has happened on multiple versions already. Currently we're running 3.5.3 |
Still no solution? This makes Strapi completely unusable in production. |
deleting the records with the below criteria on users-permissions_permission collection did solve the problem. But don't know the root cause {"role": { $exists: false} } |
This issue has been mentioned on Strapi Community Forum. There might be relevant details there: |
i go to DB and filter {"role": { $exists: false} } and fixed it but i don't know why it work |
thank you this post saved me, I got same problem on version 3.6.8, don't know why suddenly some roles are missing when I only upload some images. Got it working when I update the role at users-permissions_permission table (not delete it) |
When I migrate from alpha to v3.0.0, had an error about user-permissions plugin:
error Bootstrap function in plugin "users-permissions" failed [2020-06-12T01:15:06.300Z] error TypeError: Cannot read property '_id' of undefined at dbPermissions.map.p (/usr/src/app/node_modules/strapi-plugin-users-permissions/services/UsersPermissions.js:267:59) at Array.map (<anonymous>) at Object.updatePermissions (/usr/src/app/node_modules/strapi-plugin-users-permissions/services/UsersPermissions.js:266:46) at processTicksAndRejections (internal/process/task_queues.js:86:5)
For reproduce the error, do the next:
I guess that is something related to some DB collection but I'm no really sure
The text was updated successfully, but these errors were encountered: