oracle / bots-node-sdk

Oracle Bots Node.js SDK
https://oracle.github.io/bots-node-sdk/
Other
55 stars 53 forks source link

sdk analysis error using TS (ERROR message: Invalid component path:) #12

Open LuizPiresS opened 3 years ago

LuizPiresS commented 3 years ago

Good afternoon!!

I am using TS to develop a custom component. But I am not able to instantiate the class that contains the initial logic of the component. The TS code compiles but when the SDK analyzes the project it displays the following ERROR message: Invalid component path: /home/luizpires/dev/ODA/cognitiveservices.chatbot.oda.corona.poc/build/components/ComponentFirstVisitVerification .js. Could this be caused by a flag in tsconfig.json? Is there any way to turn off the sdk analysis?

Thank you very much for your attention

chrisk68 commented 3 years ago

Perhaps get rid of the space before .js and see if that fixes the problem.

On 06 May,2021 07:36, Luiz Pires wrote:

Good afternoon!!

I am using TS to develop a custom component. But I am not able to instantiate the class that contains the initial logic of the component. The TS code compiles but when the SDK analyzes the project it displays the following ERROR message: Invalid component path: /home/luizpires/dev/ODA/cognitiveservices.chatbot.oda.corona.poc/build/components/ComponentFirstVisitVerification .js. Could this be caused by a flag in tsconfig.json? Is there any way to turn off the sdk analysis?

Thank you very much for your attention

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/oracle/bots-node-sdk/issues/12__;!!GqivPVa7Brio!NXGsOZ9Joyxln-aflOl8xsfZjNOvOFQ6Sn1E5M9RbbahJ-njn1oC25hqKdbVzpshCg$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJVRN7YHFVDDA2RIORPBLJ3TMLHTFANCNFSM44HQ2JRQ__;!!GqivPVa7Brio!NXGsOZ9Joyxln-aflOl8xsfZjNOvOFQ6Sn1E5M9RbbahJ-njn1oC25hqKdbvMeWscw$.

-- Oracle http://www.oracle.com Chris Kutler, User Assistance Developer Office: +1.650.633.7213 Oracle Digital Assistant

LuizPiresS commented 3 years ago

There are no spaces.

The .js files are generated by the compiler. And the error only occurs when I instantiate a class (var test = new ClassName) or use a static method (ClassName.staticMethodName) from the other classes I developed to make the logic separate from component calls.

There are no errors in the code so much that it compiles without problems the component just does not pass the sdk test and thus does not go up the service.

I am developing a POC for a large client in Brazil.

Thanks

mvandervliet commented 3 years ago

This may be a problem of having util or auxiliary files within the components directory that's scanned by the registry? For example, if ComponentFirstVisitVerification.ts does not export a valid component implementation, then this error might be thrown. To solve it, just move such classes/functions into a different directory. If that doesn't work, maybe share some snippets that can reproduce the problem.

LuizPiresS commented 3 years ago

Below is the tree of the project's directories I believe that in this point everything is right. But I will identify exactly where this problem is since the project is still small

├── Dockerfile ├── README.md ├── build | ├── components | | ├── ComponentFirstVisitVerification.js | | └── helloWorld.js | ├── database | | ├── index.js | | └── models | | └── User.js | ├── database.js | ├── domain | | ├── first-visit-verification | | | └── FirstVisitVerification.js | | └── logs | | ├── @types | | └── errors | ├── main.js | ├── responses | | └── index.js | └── spec | └── helloWorld.test.js ├── dialog-flow | └── dialog-flow.yml ├── docker-compose.yml ├── jest-integration-config.js ├── jest-unit-config.js ├── jest.config.js ├── my-component-service-1.0.0.tgz ├── package-lock.json ├── package.json ├── src | ├── components | | ├── ComponentFirstVisitVerification.ts | | └── helloWorld.ts | ├── database | | ├── index.ts | | └── models | | └── User.ts | ├── database.ts | ├── domain | | ├── errors | | ├── first-visit-verification | | | └── FirstVisitVerification.ts | | └── logs | | ├── @types | | └── errors | ├── main.ts | ├── responses | | └── index.ts | └── spec | ├── helloWorld.test.ts | ├── test.cc.req.json | └── test.eh.req.json └── tsconfig.json

mvandervliet commented 3 years ago

Are you able to share the contents of ComponentFirstVisitVerification.ts and any of the static methods or constructor logic that causes the error?

LuizPiresS commented 3 years ago

Good Morning!

I managed to isolate the error. :) The error happens in classes that have mangoose calls in their methods. Today I will refactor to see if it is an error in the mangoose itself or if the error occurs in other frameworks. But in any case, I will report the evolution here.

Thanks

LuizPiresS commented 3 years ago

I believe that I managed to "solve" the problem. The error is not quite an error what happens is that the component validation is abstracting the real error, passing a generic message to the console