1

Trying to connect Adminjs to nestjs typeorm. Unable to start the application, writes an error:

UnhandledPromiseRejectionWarning: NoResourceAdapterError: There are no adapters supporting one of the resource you provided

Although separately without aAdminjs everything works. Tried adding databases to adminJsOptions, instead of: resources: [Usertest],

         {
             resource: usertest,
         },

What is wrong connected?

app.module.ts:

import { AdminModule } from '@adminjs/nestjs';
import { Database, Resource } from '@adminjs/typeorm';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { Usertest } from './usertestadminjs/entity/usertest.entity';
// import TypeORMAdapter from 'typeorm-adapter';

// AdminJS.registerAdapter(TypeORMAdapter);
AdminJS.registerAdapter({ Database, Resource });

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'postgres',
      host: 'hattie.db.elephantsql.com',
      port: 5432,
      username: 'ereree',
      password: 'rererer54f5453544',
      database: 'errerer',
      // entities: [Usertest],
      autoLoadEntities: true,
      synchronize: true,
    }),
    // ,
    AdminModule.createAdmin({
      adminJsOptions: {
        rootPath: '/admin',
        resources: [Usertest],
        // databases: [Database],
        // resources: [
        //   {
        //     resource: Usertest,
        //   },
        // ],
      },
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {} ```
Illusion
  • 71
  • 9
  • Hey, ususally this error message means that the database you're trying to connect to does not exist, or the connection URL, or credentials are invalid. Could you double check that yours are correct? – Sudet Jul 04 '22 at 08:14
  • Could you share your Usertest Entity code too? There might be a problem there ;) – Sudet Jul 04 '22 at 08:27

0 Answers0