NoResourceAdapterError: There are no adapters supporting one of the resource you provided
See original GitHub issueDescribe the bug when I try to set up AdminBro for Nest.js + typeorm I am getting the next error: UnhandledPromiseRejectionWarning: NoResourceAdapterError: There are no adapters supporting one of the resource you provided.
Installed libraries and their versions “admin-bro”: “^3.3.1”, “admin-bro-expressjs”: “^2.1.1”, “admin-bro-typeorm”: “^0.1.6-alpha.9”, “express”: “^4.17.1”, “express-formidable”: “^1.2.0”, “@nestjs/common”: “7.0.0”, “@nestjs/core”: “7.0.0”, “@nestjs/platform-express”: “7.0.0”, “@nestjs/typeorm”: “7.0.0”,
To Reproduce Steps to reproduce the behavior: Create base nest.js application and put next: main.ts
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await setupAdminPanel(app);
await app.listen(3000);
}
bootstrap();
token.entity.ts simple implementation
import AdminBro from "admin-bro";
import { Database, Resource } from '@admin-bro/typeorm';
import { validate } from 'class-validator'
AdminBro.registerAdapter({ Database, Resource });
Resource.validate = validate;
@Entity('token')
export class TokenEntity extends BaseEntity {
@Column({ type: 'varchar' })
accessToken: string;
}
Expected behavior Start server properly
Screenshots
AdminBroOptions with schema
import { INestApplication } from '@nestjs/common';
import AdminBro from 'admin-bro';
import * as AdminBroExpress from 'admin-bro-expressjs';
import { BaseEntity } from '../shared';
export async function setupAdminPanel(app: INestApplication): Promise<void> {
const adminBro = new AdminBro({
resources: [{ resource: TokenEntity, options: {} }],
rootPath: '/admin',
});
const router = AdminBroExpress.buildRouter(adminBro);
app.use(adminBro.options.rootPath, router);
}
Desktop:
- OS: macOS Catalina v10.15.7
Additional context If I set up empty resources: [], the Server and Admin panel start properly. Also, I tried to set up it by official documentation but I have the same error. Could you please, help me realize what is wrong?
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (5 by maintainers)
@Volodymyr-Zhuravlov @xinhash your Entity should extend BaseEntity.
Would be good to mention this in the docs… 😃
I am also getting similar issue. I am using prisma 4.