I have built a nodejs app with morgan module as a logger - node.js

I'm facing an issue to add custom message to each logs. My requirement is to add custom message for individual logs according to their route. How to do that ?
lets say ,
requested the URL http://localhost/user/login
user fails the login with invalid password
I want my log to have a custom message as wrong password. This message will change for each and every route.

Related

connect-flash requires refresh to show the error message

For a registration page I was trying to show an error message if the user has already registered with the same email. I was displaying that message using connect-flash. But until I refresh the message, it is not showing in the registration page. Is there any solution or any particular reason for this problem?

Azure Bot and Webchat: There was an error sending this message to your bot

I created a bot, deployed it on azure via GitHub actions and tested in the emulator, everything works fine, but when i try to connect the channel "Webchat" i keep receive errors like
There was an error sending this message to your bot: HTTP status code GatewayTimeout
There was an error sending this message to your bot: HTTP status code Unauthorized
There was an error sending this message to your bot: HTTP status code BadGateway
but it kinda changes randomly without me changing anything. Of course i set messaging endpoint in the Configuration tab (The same as i was testing in the emulator, https://appservicename.azurewebsites.net/api/messages) and the check for Enable Streaming Endpoint.
The question is: how to i fix this or how can i even find a solution when the errors are not always the same?
UPDATE More info: I made my app from basic code, i have my
const adapter = new BotFrameworkAdapter({
appId: process.env.MicrosoftAppId,
appPassword: process.env.MicrosoftAppPassword
});
ID is taken in Azure Bot Configuration Tab.
Password is created in App Secrets Key Vault, manually created under Secrets.
What im doing wrong?
According to this MSFT documentation, this can happen if you use a self-signed certificate.
If the chat window indicates one or more errors, click the error(s) for additional information. Among the most common issues are:
The bot's endpoint is specified incorrectly in the emulator settings. Ensure that the URL contains the correct port number and the correct path at the end of the URL.
A bot endpoint that starts with https is specified in the emulator settings. The endpoint on localhost should start with http.
The Microsoft App ID field and/or the Microsoft App Password fields in the emulator settings do not contain valid values. Both fields should be filled in, with each field containing the corresponding data.
Security has not been enabled for the bot. Verify that the bot configuration settings specify values for both app ID and password.
Also, try modifying the App Service's Protocol Setting. If you used Bot Composer to deploy your bot, you'll notice two App Services in the resource group: one with a 'qna' suffix and the other without. Choose the one that does not end in 'qna.'
Select the App Service --> TLS/SSL settings --> HTTPS Only --> On
References - Ref1, Ref2, Ref3.

Error using stream dashboard: CSRF Failed

Whenever I try to do any actions on the getStream dashboard, I get an error message saying CSRF failed. I can't create and app, or edit/add a feed group. Every thing fails. I attempted making a new account, logging out/in.
Any suggestions?

Edit request in js before sending it to fullfillment endpoint

I need to edit request before sending it to endpoint.
Using Web Demo integration I'm able to send request to the endpoint.
But I can't edit the request in order to provide some extra data to request. Extra data is stored in localStorage so I need to do this in javascript.
I've already connected the agent to an endpoint that handle the request using fullfillment. The problem is that request misses data I can retrieve only from the browser. From fullfillment I can set headers and basic auth but statically and it is not enough.
So I need to add a step in request building/sending:
User write or tell something to embedded chat (Web Demo integration)
Dialogflow recognize intent, params, generate the request.
Additional step: Update the request in javascript
Forward cutomized request to the endpoint
Maybe it's not possible using Web Demo integration. In Documentation can't find a way to just send string or audio in order to receive the generated request.
First of all you will need a custom chat integration, not the default Dialogflow one. Something like Smooch or Kommunicate. The default web demo should only be used for testing your bot. There is NO way you would want to use that in a production environment.
I would save whatever is in the local storage in a database such as Firestore. Once that data is in the database you can use it to modify your request in your fulfillment.
So what I would do:
Have a way to identify a user and save its local storage to the database (as soon as someone clicks on your chat window or opens the chat window)
Once an intent is triggered you check which user is contacting you (through the way that you identified the user) and get all data from the database
Request the data in your fulfillment server
There is no other way in which this is possible. You can't change requests before your query hits Dialogflow.

Receiving "Redirect_URI" Is NOT Valid Error With Outlook Contacts REST API?

I integrated the following Outlooks Contacts API with my website this way users with a hotmail.com, outlook.com, msn.com, windows live email address can easily connect to their contacts.
https://msdn.microsoft.com/office/office365/APi/contacts-rest-operations#Getcontacts
However, I keep on receiving this error when I try to log in to my hotmail email account:
The provided value for the input parameter "redirect_uri" is not valid. The expected value is "https://login.live.com/oauth20_desktop.srf" or a URL which matches the redirect URI registered for this client application.
Does anyone know what is causing this issue?
I created my app credentials again but it still doesn't work.
Thank you!
The redirect needs to match the redirect you specified when you registered your application. This should be a URL in your web app that receives auth codes.

Resources