jhipster:entity error in jhispter:client or server app - jhipster

I created an app with jhipster:client and another one with :server and tried to generate an entity 'client only' in the client app but I'm getting:
'events.js:163
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'endsWith' of undefined
at constructor.getAngularAppName (/Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/generator-jhipster/generators/generator-base.js:1604:65)
at constructor.getConfig (/Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/generator-jhipster/generators/entity/index.js:160:40)
at Object.<anonymous> (/Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/yeoman-generator/lib/index.js:417:23)
at /Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/run-async/index.js:25:25
at /Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/run-async/index.js:24:19
at /Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/yeoman-generator/lib/index.js:418:9
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)'
It works in 'server only' app.
Generating entities are only for 'full apps'?

Related

node-opcua OPCUAClient.connect error: Invalid position

When connecting to an OPCUA Server using an endpoint (opc.tcp://{serverIP:port}/OPCUASserver), I am getting an error that I do not know how to interpret.
I create an OPCUAClient using:
let client = OPCUAClient.create(clientOptions);
Then call connect
try {
await client.connect(connection.endpoint);
} catch (err) {
console.log('opcuaClient: connection error: ', err);
Here is the log message that gets printed to console:
opcuaClient: connection error: Error: Invalid position : buf.length=0 pos =0
at readTag (/node_js/app/node_modules/node-opcua-crypto/dist/source/asn1.js:36:15)
at Object.split_der (/node_js/app/node_modules/node-opcua-crypto/dist/source/crypto_explore_certificate.js:569:47)
at OPCUAClientImpl.getCertificate (/node_js/app/node_modules/node-opcua-common/dist/opcua_secure_object.js:37:52)
at OPCUAClientImpl.<anonymous> (/node_js/app/node_modules/node-opcua-client/dist/verify.js:106:34)
at Generator.next (<anonymous>)
at /node_js/app/node_modules/node-opcua-client/dist/verify.js:8:71
at new Promise (<anonymous>)
at __awaiter (/node_js/app/node_modules/node-opcua-client/dist/verify.js:4:12)
at OPCUAClientImpl.performCertificateSanityCheck (/node_js/app/node_modules/node-opcua-client/dist/verify.js:104:12)
at OPCUAClientImpl.<anonymous> (/node_js/app/node_modules/node-opcua-client/dist/private/client_base_impl.js:569:62)
at Generator.next (<anonymous>)
at /node_js/app/node_modules/node-opcua-client/dist/private/client_base_impl.js:8:71
at new Promise (<anonymous>)
at __awaiter (/node_js/app/node_modules/node-opcua-client/dist/private/client_base_impl.js:4:12)
at /node_js/app/node_modules/node-opcua-client/dist/private/client_base_impl.js:566:122
at Object.<anonymous> (/node_js/app/node_modules/#ster5/global-mutex/dist/source/index.js:194:26)
I am not sure what this error means.
Thanks!

bot won't delete message after let it go for 5 sec

I have a problem : my bot won't delete the message after letting it go for 5 sec.
Here is my code :
client.on('message', message => {
if (message.content.toLowerCase().includes(",")) {
message.delete(); // You can put it here.
}
});
The error :
log (node:492) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object.
at Message.delete (/home/runner/Boorubot-2/node_modules/discord.js/src/structures/Message.js:577:60)
at Client.<anonymous> (/home/runner/Boorubot-2/index.js:40:17)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/runner/Boorubot-2/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/runner/Boorubot-2/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/runner/Boorubot-2/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/runner/Boorubot-2/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/runner/Boorubot-2/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/runner/Boorubot-2/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:314:20)
(node:492) 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)

AWS Lambda Node error logging: Is it necessary to separately log the stack?

Some of the example code in the AWS Javascript SDK docs log the stack of an error separately to the error itself, for example this is from the AWS.CloudWatch overview:
var cloudwatch = new AWS.CloudWatch();
cloudwatch.getMetricWidgetImage(params, function (err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
So far as I can tell, this is redundant in Node (I have only tested on v10.16). If I log just the error object, it includes the stack trace:
> console.log(e)
Error: x
at repl:2:8
at Script.runInThisContext (vm.js:122:20)
at REPLServer.defaultEval (repl.js:332:29)
at bound (domain.js:402:14)
at REPLServer.runBound [as eval] (domain.js:415:12)
at REPLServer.onLine (repl.js:642:10)
at REPLServer.emit (events.js:198:13)
at REPLServer.EventEmitter.emit (domain.js:448:20)
at REPLServer.Interface._onLine (readline.js:308:10)
at REPLServer.Interface._normalWrite (readline.js:451:12)
undefined
Whereas if I log both, as Amazon have done above, I get an ugly ouput with duplication:
> console.log(e, e.stack)
Error: x
at repl:2:8
at Script.runInThisContext (vm.js:122:20)
at REPLServer.defaultEval (repl.js:332:29)
at bound (domain.js:402:14)
at REPLServer.runBound [as eval] (domain.js:415:12)
at REPLServer.onLine (repl.js:642:10)
at REPLServer.emit (events.js:198:13)
at REPLServer.EventEmitter.emit (domain.js:448:20)
at REPLServer.Interface._onLine (readline.js:308:10)
at REPLServer.Interface._normalWrite (readline.js:451:12) 'Error: x\n at repl:2:8\n at Script.runInThisContext (vm.js:122:20)\n at REPLServer.defaultEval (repl.js:332:29)\n at bound (domain.js:402:14)\n at REPLServer.runBound [as eval] (domain.js:415:12)\n at REPLServer.onLine (repl.js:642:10)\n at REPLServer.emit (events.js:198:13)\n at REPLServer.EventEmitter.emit (domain.js:448:20)\n at REPLServer.Interface._onLine (readline.js:308:10)\n at REPLServer.Interface._normalWrite (readline.js:451:12)'
undefined
Is there some reason that Amazon are using the console.log(err, err.stack) pattern that I am missing if I just do console.log(err)?
(I am primarily using Node in an AWS Lambda, version 10.x)
The console.log(err, err.stack) formula was required for Node versions < 6, as they did not log the error stack by default.
More recent Node versions can just do console.log(err).
See https://stackoverflow.com/a/33593443/1695906 for a bit more detail
(The oldest Node offered by AWS Lambda at the time of writing is Node.js 8.10, so perhaps AWS should update their docs now to remove this.)
(From "#Michael - sqlbot"'s comment, thanks!)

Error: This socket has been ended by the other party

Am deploying one node js project in a linux evniroment everything is going fine ,but after 12 to 24 hours its throwing this error and app is not working ??
Error: This socket has been ended by the other party
at Socket.writeAfterFIN [as write] (net.js:275:12)
at Protocol.<anonymous> (/opt/node/node_modules/mysql/lib/Connection.js:69:27)
at Protocol.EventEmitter.emit (events.js:95:17)
at Protocol._emitPacket (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:208:8)
at Query.<anonymous> (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:121:12)
at Query.EventEmitter.emit (events.js:95:17)
at Query.start (/opt/node/node_modules/mysql/lib/protocol/sequences/Query.js:29:8)
at Protocol._startSequence (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:262:14)
at Protocol._enqueue (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:134:10)
at Connection.query (/opt/node/node_modules/mysql/lib/Connection.js:165:25)
--------------------
at Protocol._enqueue (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:110:48)
at Connection.query (/opt/node/node_modules/mysql/lib/Connection.js:165:25)
at Object.query (/opt/node/api/database.js:78:16)
at Object.Wait.applyAndWait (/opt/node/node_modules/wait.for/waitfor.js:45:12)
at Object.Wait [as for] (/opt/node/node_modules/wait.for/waitfor.js:61:21)
at exports.getStories (/opt/node/api/stories.js:37:23)
at /opt/node/node_modules/wait.for/waitfor.js:15:31
Error: No default engine was specified and no extension was provided.
at new View (/opt/node/node_modules/express/lib/view.js:41:42)
at Function.app.render (/opt/node/node_modules/express/lib/application.js:486:12)
at ServerResponse.res.render (/opt/node/node_modules/express/lib/response.js:798:7)
at Object.errorHandler [as handle] (/opt/node/app.js:29:7)
at next (/opt/node/node_modules/express/node_modules/connect/lib/proto.js:188:17)
at Object.clientErrorHandler [as handle] (/opt/node/app.js:23:5)
at next (/opt/node/node_modules/express/node_modules/connect/lib/proto.js:188:17)
at Object.logErrors [as handle] (/opt/node/app.js:16:3)
at next (/opt/node/node_modules/express/node_modules/connect/lib/proto.js:188:17)
at next (/opt/node/node_modules/e
xpress/node_modules/connect/lib/proto.js:190:11
Dont know where I am wrong
Thanks in advance

Nodejs TypeError: Cannot read property 'chId' of undefined

I have Omegle-clone chat service. In stress my nodejs (over 150 users) crash with error "TypeError: Cannot read property 'chId' of undefined" .
/home/kotka/randomi.fi/beta/varaserver2/channel.js:67
f = this.channels[e].chId;
^
TypeError: Cannot read property 'chId' of undefined
at Channel.joinChannel (/home/kotka/randomi.fi/beta/varaserver2/channel.js:67:23)
at Session.createSession (/home/kotka/randomi.fi/beta/varaserver2/session.js:21:23)
at /home/kotka/randomi.fi/beta/varaserver2/path.js:1:268
at Server.<anonymous> (/home/kotka/randomi.fi/beta/varaserver2/fu.js:43:3)
at Server.emit (events.js:70:17)
at HTTPParser.onIncoming (http.js:1610:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
at Socket.ondata (http.js:1506:22)
at TCP.onread (net.js:374:27)
What is problem and how I can fix it?
channel.js source
try capturing the exception with
process.on('uncaughtException', function(err) {
console.error(err.stack);
});
This just means that this.channels[e] is undefined and does not have a chId attribute.

Resources