Telegraf.js Version: ^4.8.5
Node.js Version: 14.15.4
Operating System: Win 10 x64, VSCode latest
What happens:
ctx.replyWithMediaGroup can't send base64 images (media group must have a caption
Hot to send correctly?
Expected
Send images in a mediagroup
Code to reproduce:
Pastebin because it's long
It has base64 images embedded.
Just replace your token and the bot is ready to be tested and reproduce error.
Notes:
Base64 images are valid.
Pasting to any base64 to image online service produces this:
Details of the error:
(node:30228) UnhandledPromiseRejectionWarning: Error: 400: Bad Request: wrong remote file identifier specified: Wrong character in the string
at Telegram.callApi (c:\pers\sometesttg\node_modules\telegraf\lib\core\network\client.js:265:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use node --trace-warnings ... to show where the warning was created)
<node_internals>/internal/process/warning.js:44
(node:30228) 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_internals>/internal/process/warning.js:44
(node:30228) [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.
Short version:
I am looking for a way to way to run my NestJS application with the '--trace-warnings' flags that nodeJS offers. Is there some way to do this or does NestJS offer something similar?
Long version:
Hi! NestJS noob here. I am trying to run a dev version of the NestJS application I am working on. However, on starting the application I get the error below.
Clearly, it is missing a catcherror somewhere! However, the dev version has a LOT of updates and this error can be anywhere so I am hoping for a more efficient way of finding this bug than just checking every single new function! In the errormessage there are a few tips on flags to run while starting the application (node --trace-warnings ...). However, these are for node and not NestJS.
So therefore my question; is there some way to run NestJS with the --trace-warnings flag or some other efficient way to find where I am missing the catcherror?
Thanks in advance!
Error:
(node:72899) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:72899) 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:72899) [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.
(node:72899) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(node:72899) 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)
Well, 6379 is the Redis default port, it seems like Nest cannot connect to it :)
By the way, give a look at this paragraph:
https://docs.nestjs.com/exception-filters#catch-everything
In order to catch every unhandled exception (regardless of the
exception type), leave the #Catch() decorator's parameter list empty,
e.g., #Catch().
import {
ExceptionFilter,
Catch,
ArgumentsHost,
HttpException,
HttpStatus,
} from '#nestjs/common';
#Catch()
export class AllExceptionsFilter implements ExceptionFilter {
catch(exception: unknown, host: ArgumentsHost) {
const ctx = host.switchToHttp();
const response = ctx.getResponse();
const request = ctx.getRequest();
const status =
exception instanceof HttpException
? exception.getStatus()
: HttpStatus.INTERNAL_SERVER_ERROR;
response.status(status).json({
statusCode: status,
timestamp: new Date().toISOString(),
path: request.url,
});
}
}
To answer your specific question:
I am looking for a way to way to run my NestJS application with the '--trace-warnings' flags that nodeJS offers. Is there some way to do this or does NestJS offer something similar?
I've been trying to do the same thing, and there seems to be next-to-no documentation online on how to do this. Through some trial and error, I've found that this seems to work:
node --trace-warnings -r source-map-support/register --inspect dist/main
Note that this won't rebuild your application (neither when you first start it up, or by watching for changes), so you'll need to do that manually. The debugger is enabled via --inspect switch, remove that if you don't need to debug.
try to use a npm response / request logger like winston or moesif you will get a lot of help trust me.
here are the links for these library for nestjs
https://github.com/scalio/nest-couchdb
I'm trying to post form-urlencoded in Axios
This is my code
const qs = require("qs");
const axios = require("axios");
const tmp = { id: "96e8ef9f-7f87-4fb5-a1ab-fcc247647cce", filter_type: "2" };
axios
.post("https://www.lalal.ai/api/preview/", qs.stringify(tmp))
.then((result) => {
console.log(result);
});
This what I got
(node:2440) UnhandledPromiseRejectionWarning: Error: Request failed with status code 403
at createError (D:\reactjs\crud-mern\server\node_modules\axios\lib\core\createError.js:16:15)
at settle (D:\reactjs\crud-mern\server\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (D:\reactjs\crud-mern\server\node_modules\axios\lib\adapters\http.js:244:11)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2440) 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:2440) [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.
Can anyone explain to me what is the error and how to fix it? thanks :D
In the error response it states Request failed with status code 403. 403 usually means "Forbidden" and that you do not have access to perform that request. I would check to make sure you have any access keys, tokens, or authorization required to make that request.
403 Forbidden: The server understood the request, but is refusing to fulfill it. (Source)
Cloned the repository and followed all the steps mentioned in the documentation but i am unable to publish locally using "npm run publish" folder. The publish is working fine in others' machines but only i have the issue in my machine.
Expected behavior:
Code should be published to "dist/website" folder
Actual Behavior:
Getting below error on running "npm run publish" command.
Error:
(node:12516) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(node:12516) _UnhandledPromiseRejectionWarning: TypeError: invalid options argument
at optsArg (C:\Users\MAGALI\repos\Dev portal new\api-management-developer-portal-master\dist\publisher\index.js:136663:11)
at mkdirp (C:\Users\MAGALI\repos\Dev portal new\api-management-developer-portal-master\dist\publisher\index.js:136454:10)
at C:\Users\MAGALI\repos\Dev portal new\api-management-developer-portal-master\dist\publisher\index.js:183119:13
at new Promise ()
at FileSystemBlobStorage.uploadBlob (C:\Users\MAGALI\repos\Dev portal new\api-management-developer-portal-master\dist\publisher\index.js:183117:16)
at LocalStyleBuilder. (C:\Users\MAGALI\repos\Dev portal new\api-management-developer-portal-master\dist\publisher\index.js:37575:42)
at Generator.next ()
at C:\Users\MAGALI\repos\Dev portal new\api-management-developer-portal-master\dist\publisher\index.js:37560:71
at new Promise ()
at module.exports../node_modules/#paperbits/core/publishing/localStyleBuilder.ts._awaiter (C:\Users\MAGALI\repos\Dev portal new\api-management-developer-portal-master\dist\publisher\index.js:37556:12)
(node:12516) 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: 11)
(node:12516) [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 have been following along to Acadamind's NodeJS / Express / MongoDb-build a shopping cart tutorial on youtube and everything was going fine until I restarted the mongodb server when I wanted to update a product item.
Before this change, I would write npm start and the code would run smoothly, but now I am given a response of:
(node:49784) UnhandledPromiseRejectionWarning: Error: connect
ECONNREFUSED 127.0.0.1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
(node:49784) 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:49784) [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 am new to node.js and am not sure why this is occuring when I believe all i did was change a product item in my seed folder.
Here is the link to my github repository:clone my git hub "shopping-cart" repository here
Note: since this is my first node.js project that I am having problems with, is this the correct format to ask for help due to the larger nature or the project.
Thanks for any feedback!!!
Mongod needs to be running before starting the app:
sudo service mongod start
Status check:
sudo service mongod status
(should show Active (running))