nestjs-rpc icon indicating copy to clipboard operation
nestjs-rpc copied to clipboard

NestJS shared utils undefined

Open Jurabekxd opened this issue 2 years ago • 0 comments

Trying out the nestjs-rpc in my current nestjs pet project, but I've encountered error with @nestjs/common

Here is my handler

@RpcHandler({
  method: "receipts"
})
export class ReceiptsRpcHandler {
  @RpcMethodHandler("create")
  async createReceipt(
    @RpcPayload() payload: any,
    @RpcVersion() version: string,
    @RpcId() id: number | string,
    @RpcMethod() method: string
  ) {
    console.log(payload);
    return payload;
  }
}

Here is app module

@Module({
  imports: [
    JsonRpcModule.forRoot({
      path: "/rpc"
    })
  ],
  controllers: [],
  providers: [ReceiptsRpcHandler]
})
export class AppModule {
}

Here is the error code

/home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@jashkasoft/nestjs-json-rpc/dist/json-rpc.module.js:113
            const basePath = shared_utils_1.validatePath(prefix);
                                            ^
TypeError: shared_utils_1.validatePath is not a function
    at JsonRpcModule.<anonymous> (/home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@jashkasoft/nestjs-json-rpc/dist/json-rpc.module.js:113:45)
    at Generator.next (<anonymous>)
    at /home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@jashkasoft/nestjs-json-rpc/dist/json-rpc.module.js:20:71
    at new Promise (<anonymous>)
    at __awaiter (/home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@jashkasoft/nestjs-json-rpc/dist/json-rpc.module.js:16:12)
    at JsonRpcModule.onModuleInit (/home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@jashkasoft/nestjs-json-rpc/dist/json-rpc.module.js:109:16)
    at callModuleInitHook (/home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@nestjs/core/hooks/on-module-init.hook.js:51:35)
    at NestApplication.callInitHook (/home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@nestjs/core/nest-application-context.js:178:13)
    at NestApplication.init (/home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@nestjs/core/nest-application.js:96:9)
    at NestApplication.listen (/home/jay/Projects/custom-projects/nestjs-rpc-example/node_modules/@nestjs/core/nest-application.js:154:33)

Here is the dependencies

{
  "dependencies": {
    "@jashkasoft/nestjs-json-rpc": "^7.6.0",
    "@nestjs/common": "^9.0.11",
    "@nestjs/config": "^2.2.0",
    "@nestjs/core": "^9.0.0",
    "@nestjs/platform-express": "^9.0.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^9.0.0",
    "@nestjs/schematics": "^9.0.0",
    "@nestjs/testing": "^9.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "28.1.4",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "28.1.2",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "28.0.5",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.0.0",
    "typescript": "^4.3.5"
  }
}

Jurabekxd avatar Sep 10 '22 14:09 Jurabekxd