-
Notifications
You must be signed in to change notification settings - Fork 21
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
Get users/me error in deepPopulate #15
Comments
we updated the deepPopulate.ts file in the Strapi > src > middlewares folder and now the user can login and gets userdata. hope this will help others. /**
import type { Core } from '@strapi/strapi'; interface Options {
const { CREATED_BY_ATTRIBUTE, UPDATED_BY_ATTRIBUTE } = contentTypes.constants; const extractPathSegment = (url: string) => url.match(//([^/?]+)(?:?|$)/)?.[1] || ''; const getModelUID = (path: string): UID.Schema => { // Logic for regular content types const getDeepPopulate = (uid: UID.Schema, opts: Options = {}) => { // Add safety check const attributes = Object.entries(model.attributes); return attributes.reduce((acc: any, [attributeName, attribute]) => {
}, {}); export default (config, { strapi }: { strapi: Core.Strapi }) => {
}; |
Fresh installation of strapi Launchpad ending in an error when trying to get User Data after register and login.
Normal Strapi Installation works without problems.
We used Thunder Client
Logfile
error: Cannot read properties of undefined (reading 'attributes')
TypeError: Cannot read properties of undefined (reading 'attributes')
at getDeepPopulate (...\strapi\dist\src\middlewares\deepPopulate.js:15:45)
at ...\strapi\dist\src\middlewares\deepPopulate.js:68:34
at dispatch (...\strapi\node_modules\koa-compose\index.js:42:32)
at dummyMiddleware (...\strapi\node_modules@strapi\core\dist\services\server\middleware.js:25:38)
at dispatch (...\strapi\node_modules\koa-compose\index.js:42:32)
at ...\strapi\node_modules\koa-favicon\index.js:42:14
at dispatch ...\strapi\node_modules\koa-compose\index.js:42:32)
at dummyMiddleware (...\strapi\node_modules@strapi\core\dist\services\server\middleware.js:25:38)
at dispatch (...\strapi\node_modules\koa-compose\index.js:42:32)
at ...\strapi\node_modules@strapi\core\dist\middlewares\body.js:45:15
... is the project folder.
The text was updated successfully, but these errors were encountered: