I'm using puppeteer with puppeteer-cluster, this is deployed on k8s and everything works great.
The only problem I'm having is that sometimes the pod won't start, and throws this exception:
(node:24) UnhandledPromiseRejectionWarning: Error: Unable to launch browser, error message: read ECONNRESET
at Cluster.<anonymous> (/app/node_modules/puppeteer-cluster/dist/Cluster.js:107:23)
at Generator.throw (<anonymous>)
at rejected (/app/node_modules/puppeteer-cluster/dist/Cluster.js:6:65)
at process._tickCallback (internal/process/next_tick.js:68:7)
followed by:
(node:24) 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)
and:
(node:24) [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.
This doesn't affect me functionally considerably, as k8s just creates a new pod (which works fine), but I'd like to understand what happens, and if I can fix it.
Cluster initialization code:
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency: Constants.CONFIG.URL_CONCURRENCY,
retryLimit: Constants.CONFIG.CLUSTER_INTERNAL_RETRIES,
timeout: Constants.CONFIG.MAX_TIMEOUT
puppeteerOptions: { ignoreHTTPSErrors: true, args: ["--no-sandbox"] }
});
versions:
"puppeteer": "^2.0.0",
"puppeteer-cluster": "^0.18.0",
Related
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'findIndex' of undefined
at User.addToCart (D:\Pradip_All\Nodejs- tutorials video (MONGODB)\models\user.js:20:46)
at D:\Pradip_All\Nodejs- tutorials video (MONGODB)\controllers\shop.js:70:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11212) 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:11212) [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.
ERROR DESCRIPTION
You should add the ? optional chaining operator that check if the value exists in the object.
const cartProductIndex = this.cart?.items?.findIndex((cp) => {
return cp.productId.toString() === product._id.toString()
})
when i am running my app.js file i am getting UnhandledPromiseRejectionWarning: MongoParseError: Invalid connection string.
the whole error in my terminal is:
$ node app.js
(node:18676) UnhandledPromiseRejectionWarning: MongoParseError: Invalid connection string
at parseConnectionString (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\core\uri_parser.js:565:21)
at connect (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\operations\connect.js:282:3)
at C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\mongo_client.js:224:5
at maybePromise (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\utils.js:665:3)
at MongoClient.connect (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\mongo_client.js:220:10)
at C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\connection.js:820:12
at new Promise ()
at NativeConnection.Connection.openUri (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\connection.js:817:19)
at C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\index.js:345:10
at C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:5
at new Promise ()
at promiseOrCallback (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\helpers\promiseOrCallback.js:30:10)
at Mongoose._promiseOrCallback (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\index.js:1135:10)
at Mongoose.connect (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\index.js:344:20)
at Object. (C:\Users\Dell\Documents\Extra\fruit\app.js:3:10)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
(Use node --trace-warnings ... to show where the warning was created)
(node:18676) 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: 3)
(node:18676) [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:18676) UnhandledPromiseRejectionWarning: MongooseError: Operation fruits.insertOne() buffering timed out after 10000ms
at Timeout. (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:184:20)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
(node:18676) 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: 4)
The Code is given below:
const mongoose=require('mongoose');
mongoose.connect('monogodb://localhost:27017/fruitsDB',{ useNewUrlParser:true,family:4});
const fruitSchema=new mongoose.Schema({
name:String,
rating:Number,
review:String
});
const Fruit=mongoose.model("Fruit",fruitSchema);
const fruit=new Fruit({
name:"Apple",
rating:7,
review:"Pretty Good!"
});
fruit.save();
You have a typo at the beginning of your connection string, monogodb instead of mongodb.
Solution make sure your MongoDB URL connection string is correct or misspelled
"mongodb://myDBReader:D1fficultP%40ssw0rd#mongodb0.example.com:27017/?authSource=admin" or
"mongodb://mongodb0.example.com:27017"
I got the following error while trying to convert a jpeg image to webp by using Pixellena Lux API.
(node:13962) UnhandledPromiseRejectionWarning: #<RequestIssueException>
(Use `node --trace-warnings ...` to show where the warning was created)
(node:13962) 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:13962) [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.
Documentation of API.
https://pixellena.com/docs/sdk/
I just updated the following part as
let adjustments = {
"shifter": {
"steps": [
{
"scale-to": {
"width": 10
}
}
]
},
"encoder": {
"quality-measure": "fsim-c",
"qual-threshold": 2.0
}
}
This error appears because the value of "qual-threshold" must be between 0.25 and 1.0.
There is some doc about qual-threshhold at https://demo.pixellena.com/adjustments, and https://pixellena.com/docs/lux-api/ that you can check.
I'm trying to construct hyperledger fabric blockchain application. When I want to wake up the blockchain with npm:npm run env:restart, I get the following error:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Errors found in script, stopping execution
(node:4432) [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.
How can i fix this?
my nvm version: 5.6.0
my nodejs version: 8.16.0
You are missing a catch block in a promise chain in your code.
Add it like this:
var p1 = new Promise(function(resolve, reject) {
throw new Error('Uh-oh!');
});
p1.catch(function(e) {
console.log(e); // "Uh-oh!"
});
For more information on Promises and catch block specifically, refer MDN.
I'm working with the Ionic Framework in its 3rd version, and when I run ionic cordova build --release android, I get this error :
(node:13791) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object]
(node:13791) [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.
Other threads about this didn't lead me anywhere. Please help
my first attempt would be to check my code for an unhandled promise rejection.
How can i dectect a unhandled promise rejection?
assuming we have a code like this:
asyncAction.then(success => {
// do stuff with the result of success
})
so if the asyncActions fails, there is an unhandled promise rejection because we never catch the rejection of the promise. To catch the rejection we need to do this:
asyncAction.then(success => {
// do stuff with the result of success
}, rejection => {
// handle action failed
})
I solved my problem downgrading cordova version to 7.1.0