I've got a problem in my NestJs app. Project was running perfect until yesterday.
Apparently my node.js upgraded from 14.16.1 to 14.17.0. So I changed this version number in my engines object, in package.json. I executed yarn install again, to make sure everything was there, and tried yarn start:dev (which translates to nest start --watch).
But my app isn't running =(
It seems like there's something wrong regarding my apollo-server-fastify:
UnhandledPromiseRejectionWarning: Error: You must `await server.start()` before calling `server.createHandler()`
at ApolloServer.assertStarted (/app/node_modules/apollo-server-fastify/node_modules/apollo-server-core/dist/ApolloServer.js:213:19)
at ApolloServer.createHandler (/app/node_modules/apollo-server-fastify/dist/ApolloServer.js:22:14)
at GraphQLModule.<anonymous> (/app/node_modules/#nestjs/graphql/dist/graphql.module.js:150:45)
at Generator.next (<anonymous>)
at /app/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at Object.__awaiter (/app/node_modules/tslib/tslib.js:113:16)
at GraphQLModule.registerFastify (/app/node_modules/#nestjs/graphql/dist/graphql.module.js:143:24)
at GraphQLModule.<anonymous> (/app/node_modules/#nestjs/graphql/dist/graphql.module.js:118:28)
at Generator.next (<anonymous>)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:323734) 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:323734) [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 know apollo and fastify aren't the best friends right now, I've faced an issue in the past where I needed to downgrade some package, I guess. Does anyone knows how to debug/fix this? I feel clueless.
Current package versions:
"#nestjs/common": "^7.0.0",
"#nestjs/graphql": "^7.7.0",
"#nestjs/platform-fastify": "^7.6.4",
"apollo-server-fastify": "^3.0.0-alpha.3",
"graphql": "^15.5.0",
(I've also tried to upgrade apollo-server-fastify to alpha 4, but the problem persists).
TLDR
A temporary fix, until this issue is addressed by maintainers, is to copy this patch file into your repository, then modify your package.json to use the following:
"#nestjs/graphql": "patch:#nestjs/graphql#7.10.6#[YOUR/LOCAL/PATH]/graphql.patch"
Background
I ran into this same issue with my project. I'm not sure about the origin, but I did see that apollo-server-fastify was updated to 3.0.0-lambda.0 about 5 days ago and to 3.0.0-preview.0 a few hours ago.
I tracked the possible fix down to the registerFastify method in #nestjs/graphql. The solution, I believe, is to call await apolloServer.start() on line 228 in lib/graphql.module.ts before the Apollo Server's createHandler() method is called. I opened an issue on the repository with more details, which you can follow until resolved.
I implemented the fix in the template repository I'm working on with yarn patch #nestjs/graphql. The repository is available on the dev-nx branch at troncali/nest-vue. The patch is located in ./.yarn/patches/#nestjs/graphql.patch.
Related
Message&trace:
Generating browser application bundles (phase: building)...(node:5312) UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList
at new Worker (internal/worker.js:170:17)
at SassWorkerImplementation.createWorker (C:\Users\shail\iacademiaApp1\node_modules\#angular-devkit\build-angular\src\sass\sass-service.js:96:24)
at SassWorkerImplementation.render (C:\Users\shail\iacademiaApp1\node_modules\#angular-devkit\build-angular\src\sass\sass-service.js:62:40)
at Object.loader (C:\Users\shail\iacademiaApp1\node_modules\sass-loader\dist\index.js:46:3)
(node:5312) 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:5312) [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:5312) UnhandledPromiseRejectionWarning: TypeError: MessagePort was found in message but not listed in transferList
at new Worker (internal/worker.js:170:17)
at SassWorkerImplementation.createWorker (C:\Users\shail\iacademiaApp1\node_modules\#angular-devkit\build-angular\src\sass\sass-service.js:96:24)
at SassWorkerImplementation.render (C:\Users\shail\iacademiaApp1\node_modules\#angular-devkit\build-angular\src\sass\sass-service.js:62:40)
at Object.loader (C:\Users\shail\iacademiaApp1\node_modules\sass-loader\dist\index.js:46:3)
(node:5312) 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)
/ Generating browser application bundles (phase: building)...
The latest version of the Angular CLI (12.0.1) does not support Node below version 12.20.
Solution
Update your version of Node to the latest stable version
You should pick the version marked LTS, which at the time of writing is in the 14.x.x range.
Workaround
Only do this if you for some reason are completely unable to update your Node version
Add node-sass to your project devDependencies until you are able to update your version of node.
npm i -save-dev node-sass
yarn add -D node-sass
You should be careful with this workaround, as node-sass is going to be deprecated soon.
Please try this:
ng update #angular/cli
npm install
I am new to blockchain and we are using hyperledger fabric to run it.
The project instructions read:
npm i //to install dependencies
npm run env:restart //Create a new development blockchain network - From the root of your project
npm run cc:start -- supplychain //Install your smart contract
followed by command(s) to create a record in the ledger.
The first two steps are running, i.e. my network is getting set up successfully.
Step no. 3 is failing with the following error.
I have installed hurl as well. Have previously tried clearing cache as well but that did not ease things for me either.
Please help, I don't understand this error and which are the defining lines/aspects of it (might help to search). I have tried bits and parts separately but at this point an overall understanding would go a long way to help.
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 127 "/bin/sh: npm: not found
"
[hurley] - Found error while running script!
(node:22518) UnhandledPromiseRejectionWarning: Error: Errors found in script, stopping execution
at Object.<anonymous> (/home/avantika/Documents/major-blockchain/pharma-chain/node_modules/#worldsibu/hurley/dist/utils/sysWrapper.js:116:27)
at step (/home/avantika/Documents/major-blockchain/pharma-chain/node_modules/tslib/tslib.js:139:27)
at Object.next (/home/avantika/Documents/major-blockchain/pharma-chain/node_modules/tslib/tslib.js:120:57)
at /home/avantika/Documents/major-blockchain/pharma-chain/node_modules/tslib/tslib.js:113:75
at new Promise (<anonymous>)
at Object.__awaiter (/home/avantika/Documents/major-blockchain/pharma-chain/node_modules/tslib/tslib.js:109:16)
at Object.execContent (/home/avantika/Documents/major-blockchain/pharma-chain/node_modules/#worldsibu/hurley/dist/utils/sysWrapper.js:112:24)
at InstallChaincodeShGenerator.BaseGenerator.run (/home/avantika/Documents/major-blockchain/pharma-chain/node_modules/#worldsibu/hurley/dist/generators/base.js:18:40)
at ChaincodeGenerator.install (/home/avantika/Documents/major-blockchain/pharma-chain/node_modules/#worldsibu/hurley/dist/generators/chaincodegenerator.js:59:35)
at ChaincodeCLI.<anonymous> (/home/avantika/Documents/major-blockchain/pharma-chain/node_modules/#worldsibu/hurley/dist/cli.js:351:55)
(node:22518) 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: 2)
(node:22518) [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.
Im having a really odd error here...
Today I wanted to setup a new bot project but im having so much trouble!
Running under Ubuntu 18.04 if that makes any difference. Here's exactly what I did:
npm init #I follow the steps and all
npm install discord.js
npm install nodemon
touch index.js
#I start the bot
nodemon index.js
From there, i'll get an error basically telling me that index.js is empty. So, I add in the following code in it:
const discord = require("discord.js"); //import discord
var client = new discord.Client();
//console.log(client.emojis.find(emoji => emoji.name === "pkachu").id);
client.on('ready', () => {
console.log("ready to kick ass");
});
client.login('VALID discord token thing');
Sadly, i'll get the following error:
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
(node:9771) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (/home/lolcat/Documents/goodbot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:135:26)
at Client.login (/home/lolcat/Documents/goodbot/node_modules/discord.js/src/client/Client.js:220:21)
(node:9771) 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:9771) [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.
[nodemon] clean exit - waiting for changes before restart
Okay, so this thing is telling me that it has an invalid discord.js token. Alright, maybe it changed or something. Thing is, it didn't change. In fact, that token appears to still be valid and make one of my older bots work!
I've tried everything at this point. I also tried following the link it gave me but to no avail, it still "crashes".
Any tips?
If you guys think you can get away with selfbots, no you can't. :kek:
If I am trying to run the unit tests of any plugin (e.g cordova-plugin-geolocation), I have to add the tests subdirectory of the plugin in my project. While adding the tests subdirectory of a remote project, I am getting a support for subdirectories is deprecated and will be removed in Cordova#7 error.
The command I am trying to use to add the tests is
cordova plugin add http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation#:/tests.
If fetch does not support adding subdirectories, How can someone add the unit tests of a plugin in his project?
The error and the stack trace is shown below:
(node:57857) UnhandledPromiseRejectionWarning: CordovaError: --fetch does not support subdirectories
at Object.fetchPlugin [as fetch] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:71:37)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/plugin/add.js:98:40
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:810:14
at flush (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:108:17)
at process._tickCallback (internal/process/next_tick.js:61:11)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:266:19)
(node:57857) 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:57857) [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.
Adding the –-nofetch flag, does not resolve the issue either. Is cloning the project and using the location of the test directory to add to the project, the only option I have?
I am using cordova version 8.
All of a sudden this error appeared when I did npm run start.
The project is built with ant-design pro.
The sad part is that it doesn't tell me where the error is.
Could you help me find the error or to fix it.
The build just gets stuck at 91% and then I get the error message.
Here's the error:
build [================== ] 91%(node:6978) UnhandledPromiseRejectionWarning: RangeError: Invalid string length
at formatError (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Stats.js:223:30)
at Array.map (<anonymous>)
at Stats.toJson (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Stats.js:230:31)
at Compiler.<anonymous> (/home/teks/trips/may26th/smarttrips_react/node_modules/html-webpack-plugin/index.js:68:44)
at Compiler.applyPluginsAsyncSeries (/home/teks/trips/may26th/smarttrips_react/node_modules/tapable/lib/Tapable.js:206:13)
at Compiler.emitAssets (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Compiler.js:354:8)
at onCompiled (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Compiler.js:58:19)
at applyPluginsAsync.err (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Compiler.js:510:14)
at next (/home/teks/trips/may26th/smarttrips_react/node_modules/tapable/lib/Tapable.js:202:11)
at Compiler.<anonymous> (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/CachePlugin.js:78:5)
at next (/home/teks/trips/may26th/smarttrips_react/node_modules/tapable/lib/Tapable.js:204:14)
at /home/teks/trips/may26th/smarttrips_react/node_modules/hard-source-webpack-plugin/index.js:2075:7
at <anonymous>
(node:6978) 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:6978) [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.
EDIT : I also updated my npm to ver 6 but still get the same error message. please advise.
Well, I had been searching and now I found an issue posted which helped me out.
Basically, adding this code to my package.json is what helped me out.
"start": "HARD_SOURCE=none npm run _start", "_start": "cross-env ESLINT=none roadhog dev",
I couldnt understand much more of why as it was written in chinese,
Anyways, here's the link to the github issue as it may help some of you understand what was wrong.
antdesign github issue fixed here
It might be coz the localhost is not defined with the required syntax in the "hosts" file of the system.
The file can be located #:
linux
etc/hosts
Windows
c:\ **Windows** \System32\Drivers\ **etc** \ **hosts**
i.e. file has some wrong input.
So, Try replacing everything in that file with the text below as this is the default text that was always there in hosts file when it worked fine:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost