moleculerjs / moleculer-template-project-typescript

Typescript project template for Moleculer microservices framework.
MIT License
123 stars 45 forks source link

Broker with API Gateway not starting after init. #69

Closed sajidali closed 8 months ago

sajidali commented 9 months ago

services/api.service.ts:78:5 - error TS2322: Type '{ path: string; whitelist: string[]; use: never[]; mergeParams: true; authentication: false; authorization: false; autoAliases: true; aliases: {}; callingOptions: {}; bodyParsers: { json: { strict: false; limit: string; }; urlencoded: { ...; }; }; mappingPolicy: "all"; logging: true; }' is not assignable to type 'ApiRouteSchema'. Object literal may only specify known properties, but 'callingOptions' does not exist in type 'ApiRouteSchema'. Did you mean to write 'callOptions'? 78 callingOptions: {},

After running moleculer init project-typescript projectname, when trying to run the project using npm run dev, I am getting above error.

Here are my configuration when setting up project.

? Add API Gateway (moleculer-web) service? (Y/n) Y
? Add API Gateway (moleculer-web) service? Yes
? Would you like to communicate with other nodes? (Y/n) Y
? Would you like to communicate with other nodes? Yes
? Select a transporter (Use arrow keys)
? Select a transporter NATS (recommended)
? Would you like to use cache? (y/N) N
? Would you like to use cache? No
? Add DB sample service? (Y/n) n
? Add DB sample service? No
? Would you like to enable metrics? (Y/n) n
? Would you like to enable metrics? No
? Would you like to enable tracing? (Y/n) n
? Would you like to enable tracing? No
? Add Docker & Kubernetes sample files? (Y/n) Y
? Add Docker & Kubernetes sample files? Yes
? Use ESLint to lint your code? (Y/n) Y
? Use ESLint to lint your code? Yes
Create 'mlclr-broken' folder...
? Would you like to run 'npm install'? (Y/n) Y
? Would you like to run 'npm install'? Yes
sajidali commented 9 months ago

So it turns out, that api.service.ts has a spelling issue, callingOptions should be callOptions, This can be verified from ApiSettingsSchema, and also from moleculer-web.html#Calling-options

sajidali commented 9 months ago

After fixing above issue, I encountered #67, which was solved using suggestion provided in #67.