Azure Bot is not Responding On Teams - azure

I have a bot built with Microsoft Bot framework Node.JS SDK, the bot is deployed on a windows server and has been working well for over a year.
Just a few days ago, the Bot stopped responding, checked the bot's log and came across this error.
node:14628) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:14628) UnhandledPromiseRejectionWarning: Error: BotFrameworkAdapter.processActivity(): 400 ERROR
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (C:\inetpub\wwwroot\BotServiceToken\node_modules\botbuilder\lib\botFrameworkAdapter.js:1262:37)
at IncomingMessage.emit (events.js:327:22)
at IncomingMessage.EventEmitter.emit (domain.js:482:12)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
at BotFrameworkAdapter.<anonymous> (C:\inetpub\wwwroot\BotServiceToken\node_modules\botbuilder\lib\botFrameworkAdapter.js:687:27)
at Generator.throw (<anonymous>)
at rejected (C:\inetpub\wwwroot\BotServiceToken\node_modules\botbuilder\lib\botFrameworkAdapter.js:12:65)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14628) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:14628) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Note: The bot works well when I test with the Botframework Emulator.
Is there a way to solve this, I have checked the botFrameworkAdapter.js file mentioned in the error but I can't seem to find the bug.

Just like the warning said
DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
To avoid the depreciation warning. You need to find out the new Buffer() methods in your codes and replace them with a new one.

Related

Error: 7 PERMISSION_DENIED: The signature of device credential in position 0 could not be verified against any registry certificate

I am trying to register my IoT device using a generated Service account json credentials.
The underlying library is a MQTT (bridge) and google-cloud/iot (nodejs) - this repo (https://github.com/balena-io-examples/google-iot), or this documentation for details.
The service account json is pasted within the ENV variable GOOGLE_IOT_SERVICE_ACCOUNT_TOKEN as a single line json formatted.
When it tries to register the device and add it to the registry automatically I am getting the following error:
[Google IoT] Connecting to Google IoT Core ...
[Google IoT] Device ID: id-00000000000000000000000000000000
[Google IoT] Project: google-iot-project-id
[Google IoT] Region: google-iot-region
[Google IoT] Registry: google-iot-registry
[Google IoT] Device with name id-00000000000000000000000000000000 not registered. Attempting to register...
Generating a RSA private key
........................+++++
................................................................................................................................................................................................................+++++
writing new private key to 'rsa-priv.pem'
-----
read EC key
writing EC key
[MQTT] Refreshing jwt token ...
{ host: 'mqtt.googleapis.com',
port: 8883,
clientId:
'projects/google-iot-project-id/locations/google-iot-region/registries/google-iot-registry/devices/id-00000000000000000000000000000000',
username: 'unused',
password:
'generated-password',
protocol: 'mqtts',
secureProtocol: 'TLSv1_2_method',
project: 'google-iot-project-id' }
[MQTT] Opening connection ...
(node:156) UnhandledPromiseRejectionWarning: Error: 7 PERMISSION_DENIED: The signature of device credential in position 0 could not be verified against any registry certificate.
at Object.callErrorFromStatus (/app/node_modules/#grpc/grpc-js/build/src/call.js:31:26)
at Object.onReceiveStatus (/app/node_modules/#grpc/grpc-js/build/src/client.js:179:52)
at Object.onReceiveStatus (/app/node_modules/#grpc/grpc-js/build/src/client-interceptors.js:336:141)
at Object.onReceiveStatus (/app/node_modules/#grpc/grpc-js/build/src/client-interceptors.js:299:181)
at process.nextTick (/app/node_modules/#grpc/grpc-js/build/src/call-stream.js:145:78)
at processTicksAndRejections (internal/process/task_queues.js:79:9)
(node:156) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:156) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[MQTT] MQTT error { Error: Connection refused: Not authorized
Has anyone faced any issues using NodeJS libraries to register & use Google IoT (Core) cloud service?
Am I doing something wrong? Any help is very appreciated!

Protractor: how to debug unhandled Promise Rejections?

After a huge PR, our E2E has started taking almost 4 hours to execute.
Reading the log, I've found the following line:
(node:6600) UnhandledPromiseRejectionWarning: Unhandled promise
rejection. This error originated either by throwing inside of an async
function without a catch block, or by rejecting a promise which was
not handled with .catch(). To terminate the node process on unhandled
promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
(rejection id: 2)
The official docs did not bring any information, so I've found this doc, that says:
--unhandled-rejections strict mode causes an uncaught exception
The question is:
is there any way to use this flag with Protractor? Or how can I debug to find this exception?

I got an error while running dist file in nestjs project, please help me

(node:8356) UnhandledPromiseRejectionWarning: Error: No type definitions were found with the specified file name patterns: "./**/*.graphql". Please make sure there is at least one file that matches the given patterns.
at GraphQLTypesLoader.<anonymous> (E:\NestJS\Template_Login\teample-api-backend-nestjs\backend\node_modules\#nestjs\graphql\dist\graphql-types.loader.js:38:23)
at Generator.next (<anonymous>)
at fulfilled (E:\NestJS\Template_Login\teample-api-backend-nestjs\backend\node_modules\tslib\tslib.js:114:62)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:8356) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async
function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8356) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I ran into the same issue. This is most likely caused by the fact that the .graphql files are ignored in build time and not copied to /dist. Interestingly, I didn't have that before and the build seemed to complete just fine, it appeared only today.
I found a workaround to the problem proposed by the NestJS creator:
https://github.com/nestjs/graphql/issues/135
https://docs.nestjs.com/cli/monorepo#assets
There is assets option in nestjs.
This is the right way to do it in nestjs.

Discord.js Bot [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted Error

I'm having issues with Discord.js Bot on v13+. I'm getting [DISALLOWED_INTENTS] error. How can I fix this? Thanks.
(node:16060) UnhandledPromiseRejectionWarning: Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted. at WebSocketManager.createShards (C:\Users\schne\Desktop\Zeltux_v1.5.2\node_modules\discord.js\src\client\websocket\WebSocketManager.js:260:15)
[05:24:04] (node:16060) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[05:24:04] (node:16060) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
As the error suggests, [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted, you're probably using an intent that hasn't been enabled.
Gateway Intents were introduced to the library in v12 and allow you to pick which events your bot will receive. Intents are groups of pre-defined events that the discord.js client will conditionally subscribe to. For example, omitting the DIRECT_MESSAGE_TYPING intent would prevent the discord.js client from receiving any typing events from direct messages.
You'll have to go to Discord Developer Portal, choose your application, go to the Bot section, and enable all the intents. (Or the ones you are using.)

Gcloud initialized to wrong project

When trying to run my Nodejs application which uses the Google-Cloud-Video-Intelligence API, I am getting an error:
(node:20730) UnhandledPromiseRejectionWarning: Error: 7 PERMISSION_DENIED: Cloud Video Intelligence API has not been used in project firebase-cli before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/videointelligence.googleapis.com/overview?project=firebase-cli then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
at new createStatusError (/home/warcram/node_modules/grpc/src/client.js:64:15)
at /home/warcram/node_modules/grpc/src/client.js:583:15
(node:20730) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20730) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.e
Now, this would be fixable if I was using the firebase-cli project, however this has since been deleted. I am now trying to use a separate project. I used gcloud init in the same directory for the new project, however when running the application I still get the same errors.
Is there anyway that I can uninitialize the firebase-cli project and continue with my new one?
Many thanks
Figured the issue out, I needed to set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the initialization json file. I did this and my program worked using the correct project. Thanks for any views, hope this helps in the future.

Resources