How to prevent swagger from showing allowed methods GET? - node.js

I realized that when I try to access one of the paths defined in my swagger 2.0 with an incorrect method (ie. GET instead of POST), I receive the following message:
{"message":"Route defined in Swagger specification (/movie) but there is no defined get operation.","allowedMethods":["POST"]}
I am getting the above error. I am using nodeJs server and What i will add into the nodejs file.. Anyone help me how to solve this error.

Related

node-soap working differently with different wsdl files. I am getting this error "TypeError: Cannot read property 'postProcess' of undefined"

I am using node-soap to create a soap client. I have tried with different WSDL files and worked fine but one WSDL file seems complex. I tested this WSDL with SOAPUI and worked fine. But if I try to create a soap client, it is throwing the following error. Any help really appreciated!!!
TypeError: Cannot read property 'postProcess' of undefined
I am sharing the link to the WSDL file.
WSDL link
Full-stack trace of error
*TypeError: Cannot read property 'postProcess' of undefined
at OperationElement.postProcess (D:\MY_PROJECTS\NODE-SOAP\node-soap-ts\node_modules\soap\src\wsdl\elements.ts:874:15)
at PortTypeElement.postProcess (D:\MY_PROJECTS\NODE-SOAP\node-soap-ts\node_modules\soap\src\wsdl\elements.ts:914:13)
at BindingElement.postProcess (D:\MY_PROJECTS\NODE-SOAP\node-soap-ts\node_modules\soap\src\wsdl\elements.ts:968:16)
at ServiceElement.postProcess (D:\MY_PROJECTS\NODE-SOAP\node-soap-ts\node_modules\soap\src\wsdl\elements.ts:1042:19)
at D:\MY_PROJECTS\NODE-SOAP\node-soap-ts\node_modules\soap\src\wsdl\index.ts:112:30
at WSDL._processNextInclude (D:\MY_PROJECTS\NODE-SOAP\node-soap-ts\node_modules\soap\src\wsdl\index.ts:1186:14)
at WSDL.processIncludes (D:\MY_PROJECTS\NODE-SOAP\node-soap-ts\node_modules\soap\src\wsdl\index.ts:173:10)
at D:\MY_PROJECTS\NODE-SOAP\node-soap-ts\node_modules\soap\src\wsdl\index.ts:101:12
at processTicksAndRejections (internal/process/task_queues.js:75:11)*
I had the same issue with one of the WSDL files. I would like to add something here. Try to add the extension Wizdler which is available in chrome. Once you try to open the code in chrome and run the extension, you can easily find out the data model and the methods used in the WSDL file. So, with your WSDL file, this is what I got as the result in Wizdler.
This might be helpful to resolve your issue.

Logging firebase warnings

I am getting the following warning on the console of my nodejs app:
FIREBASE WARNING: Provided authentication credentials for the app
named "[DEFAULT]" are invalid. This usually indicates your app was not
initialized correctly. Make sure the "credential" property provided to
initializeApp() is authorized to access the specified "databaseURL"
and is from the correct project.
Is there a way to send this kind of warnings to a logger?
I don't find nothing of the kind for nodeJs Admin SDK
Just to make absolutely clear, i am not concert with the error itself, only how to log all relevant problems, occurred on my code or on the library code, into one single file that i can look at.
Also, the warning is not possible to log by the api caller because it is not send it back to the caller.
Specify a custom log function via admin.database().enableLogging(). See the examples in the reference docs.

Error in setting up swagger in expressjs project

I have followed [this][1] link to add swagger to my existing project. I encountered the following error while setting up swagger. Any leads will be highly appreciated.
:xxx\node_modules\swagger-node-express\Common\node\
swagger.js:84
self.appHandler.get(self.resourcePath.replace(self.formatString, self.jsonSuff
ix), resourceListing);
^TypeError: Cannot read property 'get' of null
[1]: https://github.com/shawngong/Swagger-Node-Express-For-Existing-APIs
This error is popping out because of -
var applicationUrl = 'http://localhost:9000'; //application runs properly on this url
swagger.configure(applicationUrl, '1.0.0');//error here
Looking at the line of code in question node-swagger-express it seems as if you need to call :
swagger.setAppHandler(app);
Before the configure call.
I specifically see the maintainer of the project you are using (https://github.com/shawngong/Swagger-Node-Express-For-Existing-APIs) has a commit message related to setAppHandler in his last commit. Perhaps there is now an issue related to it.

NemakiWare "CMIS Exception: permissionDenied"

I'm trying to create new CMIS type using Workbench and always get the message:
"CMIS Exception: permissionDenied".
Does anybody has experience with NemakiWare how to solve this problem?
Thank you in advance.
I was getting this misleading message using a different CMIS-compliant repository (Alfresco) when referencing a deprecated link structure for the CMIS endpoint.
i.e., older versions of Alfresco provide an AtomPub endpoint like this:
http://cms.mysite.com/alfresco/cmisatom
Newer versions implement this structure:
http://cms.mysite.com/alfresco/api/-default-/public/cmis/versions/1.0/atom
If I attempted to access the former link, I'd get an "access denied" message. Make sure your endpoint fits the structure appropriate to the version of NemakiWare you're running.

Globle error filter in node js

I am working on node from last 2-3 months on a project. Now I want to handle errors from a single point in node. For example : I have several api functions in my project. Many of them are taking _id as an api input. I need to parse this id using mongoose objectid before using in query. Now if the format of _id is not valid, it will throw the casting error. It could be handled by mongoose object isvalid property. But my purpose is that, at any place if it is not handled in code I want to catch the error and log it to my log file and send a common message like 'error occurs' to the UI. I want to add a common error handler for all the api that do the logging and error handling for my api, like we use .net MVC - error handler filer through the application.
I have tried using domain. But in domain.on('error',func(err){}); it is not working. I put my api functions call in domain.run();
If any body have any suggestion for me, please let me know.
Take a look at the domain module, if your app powered by express you can use the package - express-domain-middleware

Resources