I am try to call GetUserHistory in Postman and i get error 12 unimplemented. And I don't understand why. I have two modules in my service, Users and History. The Users module works properly and I created the History module in the same way as Users. The Users and History is loaded by AuthModule
Main.ts
async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>(AuthModule, {
transport: Transport.GRPC,
options: {
protoPath: [join(__dirname, '../auth.proto'), join(__dirname, '../history.proto')],
package: AUTH_PACKAGE_NAME,
url: 'localhost:6000',
},
});
await app.listen();
}
bootstrap();
AuthModule (there are not all code because Discord has char limit in 2000, ConfigModule and TypeOrmModule are simply configured here)
@Module({
imports: [
UsersModule,
HistoryModule,
]
})
export class AuthModule {}
History Controller code:
@Controller()
@HistoryServiceControllerMethods()
export class HistoryController implements HistoryServiceController {
constructor(private readonly historyService: HistoryService) {}
@GrpcMethod('HistoryService', 'GetUserHistory') // Tried to explicitly specify the method, but still unimplemented error
async getUserHistory(request: GetHistoryDto): Promise<UserHistory> {
return await this.historyService.getHistoryById(request.uuid);
}
}
history.proto
syntax = "proto3";
package history;
option java_package = "org.alexincube.eximiaauth.eximiaAuth";
service HistoryService{
rpc GetUserHistory (GetHistoryDto) returns (UserHistory) {};
}
message UserHistory {
string uuid = 1;
repeated HistoryEntry history = 2;
}
message HistoryEntry{
int64 id = 1;
string uuid = 2;
int64 time = 3;
string ip = 4;
}
message CreateHistoryEntryDto {
string uuid = 1;
string ip = 2;
}
message GetHistoryDto {
string uuid = 1;
}