Deprecation Warning Error with Blockchain - node.js

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.

Related

UnhandledPromiseRejectionWarning on Request to Pixellena Lux API

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.

React-Admin: `make` commands are failing

I'm trying to get my local environment working after cloning the react-admin repo.
I'm tried to run make install and make build as guided by the docs, but these won't work for me.
I install make globally. And yarn, npm and nodejs are all up-to-date. I'm on Windows-10 using Visual Studio Code with PowerShell terminal.This is what I get...
make install returns:
make i info Invoking install target
(node:7316) UnhandledPromiseRejectionWarning: undefined
(node:7316) 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:7316) [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.
make × ERR not found: make-package.json
make build returns:
(node:9000) UnhandledPromiseRejectionWarning: undefined
(node:9000) 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:9000) [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.
make × ERR not found: make-##
I really want to get started on my ra fix branch so any help would be appreciated.Hopefully, it's just a simple mistake on my end.
It's interesting to note that make is primarily a utility tool for the unix env.
Therefore running make commands is not a direct process in windows environment.
NMAKE is the official windows alternative that will help you achieve the same.

Puppeteer cluster sometimes cannot start in k8s

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",

(node:13606) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object] - Ionic Framework

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

"Unhandled promise rejection" error when installing ionic 2 plugins

I get the following error during installation of the Cordova OneSignal plugin:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object]
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 couldn't find any solutions on Google.

Resources