Problem with Authentication
proflamyt opened this issue · comments
i tried to use the adminjs with prisma according to the documentation
`
AdminModule.createAdminAsync({
imports: [PrismaModule],
inject: [PrismaService],
useFactory: (prisma:PrismaService) => {
const dmmf = ((prisma as any)._baseDmmf as DMMFClass)
return {
adminJsOptions: {
rootPath: '/admin',
resources: [{
resource: { model: dmmf.modelMap.User, client: prisma },
options: {},
}],
},
auth: {
authenticate,
cookieName: 'adminjs',
cookiePassword: 'secret'
},
sessionOptions: {
resave: true,
saveUninitialized: true,
secret: 'secret'
},
}
}
}),
AuthModule, UserModule, PrismaModule, CoursesModule, ProfileModule,],
controllers: [],})
export class AppModule {}
`
i get this error anytime the authentication is added for the endpoint
(node:17912) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'default' of undefined at chunk (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\@adminjs\design-system\build\atoms\box\box.js:47:51) at flatten (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\utils\flatten.js:68:22) at e.generateAndInjectStyles (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\models\ComponentStyle.js:91:29) at useInjectedStyle (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\models\StyledComponent.js:87:22) at propsForElement (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\models\StyledComponent.js:125:30) at styled.section (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\styled-components\src\models\StyledComponent.js:174:44) at renderWithHooks (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5662:16) at renderForwardRef (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5846:18) at renderElement (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:6009:11) at renderNodeDestructiveImpl (C:\Users\USER\Documents\GitHub\acad-backend-api\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:6108:11)
It looks like you have multiple packages of:
styled-components
react-dom
or react
in your node_modules
oh, thank you . the problem was I had to install styled-components. I have no idea why this was the case though