'notice' ? new NoticeMessage(length, messageValue) : new DatabaseError(messageValue, length, name) - visual-studio-code

i am getting an error like this
C:\Users\gulct\Desktop\mappix\MapPix-Backend-V0.0.1 Beta\node_modules\pg-protocol\src\parser.ts:369
name === 'notice' ? new NoticeMessage(length, messageValue) : new DatabaseError(messageValue, length, name)
^
error: client selected an invalid SASL authentication mechanism
at Parser.parseErrorMessage (C:\Users\gulct\Desktop\mappix\MapPix-Backend-V0.0.1 Beta\node_modules\pg-protocol\src\parser.ts:369:69)
at Parser.handlePacket (C:\Users\gulct\Desktop\mappix\MapPix-Backend-V0.0.1 Beta\node_modules\pg-protocol\src\parser.ts:188:21)
at Parser.parse (C:\Users\gulct\Desktop\mappix\MapPix-Backend-V0.0.1 Beta\node_modules\pg-protocol\src\parser.ts:103:30)
at Socket.<anonymous> (C:\Users\gulct\Desktop\mappix\MapPix-Backend-V0.0.1 Beta\node_modules\pg-protocol\src\index.ts:7:48)
at Socket.emit (node:events:527:28)
at Socket.emit (node:domain:475:12)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
[nodemon] app crashed - waiting for file changes before starting...
the file giving the error
let fieldType = this.reader.string(1)
while (fieldType !== '\0') {
fields[fieldType] = this.reader.cstring()
fieldType = this.reader.string(1)
}
const messageValue = fields.M
const message =
name === 'notice' ? new NoticeMessage(length, messageValue) : new DatabaseError(messageValue, length, name)
message.severity = fields.S
message.code = fields.C
message.detail = fields.D
message.hint = fields.H
message.position = fields.P
message.internalPosition = fields.p
message.internalQuery = fields.q
message.where = fields.W
I will be glad if you can solve this.
I couldn't do anything because I didn't know anything about it. I pressed ctrl + c, then I entered the npm install command and when I wrote the npm run dev code, it gave this error.

Related

Sails app crash when not calling skipper upload

If I call req.file('files') and not calling updload (for example because I throw validation error) the app crashes.
const files = req.file('files')
if (!files || files.length === 0) {
throw "MISSING_ARGUMENTS"; // intentally fails here
}
file.upload() // not reaching here
error :
events.js:173
throw er; // Unhandled 'error' event
^
Error: EMAXBUFFER: An Upstream (`NOOP_files`) timed out before it was plugged into a receiver. It was still unused after waiting 4500ms. You can configure this timeout by changing the `maxTimeToBuffer` option.
at Timeout.<anonymous> (../node_modules/sails/node_modules/skipper/standalone/Upstream/Upstream.js:86:15)
at listOnTimeout (timers.js:327:15)
at processTimers (timers.js:271:5)
Emitted 'error' event at:
at Upstream.fatalIncomingError (../node_modules/sails/node_modules/skipper/standalone/Upstream/prototype.fatalIncomingError.js:95:8)
at Timeout.<anonymous> (../node_modules/sails/node_modules/skipper/standalone/Upstream/Upstream.js:93:12)
at listOnTimeout (timers.js:327:15)
at processTimers (timers.js:271:5)
Waiting for the debugger to disconnect...
Error: EMAXBUFFER: An Upstream (`NOOP_files`) timed out before it was plugged into a receiver. It was still unused after waiting 4500ms. You can configure this timeout by changing the `maxTimeToBuffer` option.
at Timeout.<anonymous> (../node_modules/sails/node_modules/skipper/standalone/Upstream/Upstream.js:86:15)
at listOnTimeout (timers.js:327:15)
at processTimers (timers.js:271:5)
Emitted 'error' event at:
at Upstream.fatalIncomingError (../node_modules/sails/node_modules/skipper/standalone/Upstream/prototype.fatalIncomingError.js:95:8)
at Timeout.<anonymous> (../node_modules/sails/node_modules/skipper/standalone/Upstream/Upstream.js:93:12)
at listOnTimeout (timers.js:327:15)
at processTimers (timers.js:271:5)
I was also facing the same issue, in my case, I checked with allParams() that will prevent app from crashing.
const fileDetials = !('image' in req.allParams()) ? req.file('fieldName') : '';

Error in onSnapshot: FirebaseError: [code=invalid-argument]: transaction closed

I'm recursively loading a tree stored in Firestore. The tree has ~79 nodes.
Very occasionally I'm getting this error (about one in ten full-tree loads).
Edit: the code: https://github.com/karol-depka/OrYoL
Edit: the example deployed: https://oryol.karoldepka.com/tree (sorry, no plunker for now, just this)
Details below.
Firebase version in package.json: 4.5.0
Questions:
Where can I get more info than this basic documentation https://firebase.google.com/docs/reference/js/firebase.FirebaseError
?
What is the source of the problem and how to fix it?
3VM724:27 Uncaught Error in onSnapshot: Error: transaction closed
at new FirestoreError (error.js:164)
at JsonProtoSerializer.webpackJsonp.../../../../firebase/firestore/remote/serializer.js.JsonProtoSerializer.fromRpcStatus (serializer.js:126)
at JsonProtoSerializer.webpackJsonp.../../../../firebase/firestore/remote/serializer.js.JsonProtoSerializer.fromWatchChange (serializer.js:517)
at PersistentListenStream.webpackJsonp.../../../../firebase/firestore/remote/persistent_stream.js.PersistentListenStream.onMessage (persistent_stream.js:334)
at persistent_stream.js:270
at persistent_stream.js:247
at async_queue.js:81
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:392)
at Object.onInvoke (core.es5.js:3890)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
The code:
private processNodeEvents(nestLevel: number, snapshot: any, parents, listener: DbTreeListener) {
const serviceThis = this
snapshot.docChanges.forEach(function(change) {
let data = change.doc.data()
if (change.type === 'added') {
const parentsPath = serviceThis.nodesPath(parents)
console.log('node: ', nestLevel, parentsPath, data);
serviceThis.pendingListeners ++
data.node.onSnapshot(targetNodeDoc => {
serviceThis.pendingListeners --
listener.onNodeAdded(
new NodeAddEvent(parentsPath, parentsPath[parentsPath.length - 1], targetNodeDoc, targetNodeDoc.id,
serviceThis.pendingListeners))
console.log('target node:', nestLevel, targetNodeDoc)
console.log('target node title:', nestLevel, targetNodeDoc.data().title)
const subCollection = targetNodeDoc.ref.collection('subNodes')
console.log('subColl:', subCollection)
subCollection.onSnapshot((subSnap: QuerySnapshot) => {
const newParents = parents.slice(0)
newParents.push(targetNodeDoc.ref)
serviceThis.processNodeEvents(nestLevel + 1, subSnap, newParents, listener)
})
})
// console.log('root node ref: ', targetNode);
}
if (change.type === 'modified') {
console.log('Modified city: ', data);
}
if (change.type === 'removed') {
console.log('Removed city: ', data);
}
})
}
Edit: another error discovered, by running the code multiple times:
VM3343:27 Uncaught Error in onSnapshot: Error: The referenced transaction has expired or is no longer valid.
at new FirestoreError (error.js:164)
at JsonProtoSerializer.webpackJsonp.../../../../firebase/firestore/remote/serializer.js.JsonProtoSerializer.fromRpcStatus (serializer.js:126)
at JsonProtoSerializer.webpackJsonp.../../../../firebase/firestore/remote/serializer.js.JsonProtoSerializer.fromWatchChange (serializer.js:517)
at PersistentListenStream.webpackJsonp.../../../../firebase/firestore/remote/persistent_stream.js.PersistentListenStream.onMessage (persistent_stream.js:334)
at persistent_stream.js:270
at persistent_stream.js:247
at async_queue.js:81
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:392)
at Object.onInvoke (core.es5.js:3890)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
window.console.error # VM3343:27
Edit: update firebase to 4.6.0, problem happened 3 times:
Uncaught Error in onSnapshot: Error: transaction closed
at new FirestoreError (error.js:149)
at JsonProtoSerializer.webpackJsonp.../../../../#firebase/firestore/dist/esm/src/remote/serializer.js.JsonProtoSerializer.fromRpcStatus (serializer.js:93)
at JsonProtoSerializer.webpackJsonp.../../../../#firebase/firestore/dist/esm/src/remote/serializer.js.JsonProtoSerializer.fromWatchChange (serializer.js:536)
at PersistentListenStream.webpackJsonp.../../../../#firebase/firestore/dist/esm/src/remote/persistent_stream.js.PersistentListenStream.onMessage (persistent_stream.js:309)
at persistent_stream.js:246
at persistent_stream.js:222
at async_queue.js:62
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:392)
at Object.onInvoke (core.es5.js:3890)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
Edit: even if the error happens, the tree seems to continue loading.
Edit: another version of the error, with code=aborted (after upgrading firebase to 4.6.0):
Error in onSnapshot: FirebaseError: [code=aborted]: The referenced transaction has expired or is no longer valid.
/vendor.bundle.js:18588 errHandler()
/vendor.bundle.js:33367
/polyfills.bundle.js:2970 ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask()
/vendor.bundle.js:107276 Object.onInvokeTask()
/polyfills.bundle.js:2969 ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask()
/polyfills.bundle.js:2737 Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask()
/polyfills.bundle.js:3044 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask()
/polyfills.bundle.js:3033 ZoneTask.invoke()
I have more or less the same and it is random when it works and don't. I don't use snapshot, but valueChanges
ERROR Error: transaction closed
at new FirestoreError (error.js:149)
at JsonProtoSerializer.webpackJsonp.../../../../#firebase/firestore/dist/esm/src/remote/serializer.js.JsonProtoSerializer.fromRpcStatus (serializer.js:93)
at JsonProtoSerializer.webpackJsonp.../../../../#firebase/firestore/dist/esm/src/remote/serializer.js.JsonProtoSerializer.fromWatchChange (serializer.js:536)
at PersistentListenStream.webpackJsonp.../../../../#firebase/firestore/dist/esm/src/remote/persistent_stream.js.PersistentListenStream.onMessage (persistent_stream.js:309)
at persistent_stream.js:246
at persistent_stream.js:222
at async_queue.js:62
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:392)
at Object.onInvoke (core.es5.js:3890)
at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
For me it's this peace of code that provokes the error:
return Observable.forkJoin(entries.map(entry => {
return this.getPick(entry)
}))
each entry in entries is used to return a single pick from firestore.
private getPick(entryId: number) {
return this.afs.collection<Pick>('entry/' + entryId + '/event/' + '9/' + 'picks', ref => ref.where('is_captain','==',true))
.valueChanges()
I don't mean to hijack your thread, but I feel this is very relevant. If I change the forkJoin to
Observable.forkJoin(entries.slice(0,20)...
then it works, so I guess it is some kind of overload of queries.

Meteor email sending buggy when sending multiple emails in a short time

Quite new to Meteor.
I am sending an email when a user presses a button. I get these errors when I press the button:
I20170801-10:37:06.225(8)? Exception in defer callback: Error: Mail command failed: 503 5.5.2 Sender already specified [KL1PR03MB1416.apcprd03.prod.outlook.com]
I20170801-10:37:06.226(8)? at Object.Future.wait (/Users/duminda/.meteor/packages/meteor-tool/.1.4.3_2.1bvf0xf++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
I20170801-10:37:06.226(8)? at SMTPConnection._syncSend (packages/meteor.js:213:24)
I20170801-10:37:06.226(8)? at smtpSend (packages/email.js:112:8)
I20170801-10:37:06.227(8)? at Object.Email.send (packages/email.js:208:5)
I20170801-10:37:06.227(8)? at server/Travel/methods.js:5:19
I20170801-10:37:06.228(8)? at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
I20170801-10:37:06.228(8)? at packages/meteor.js:445:45
I20170801-10:37:06.229(8)? at runWithEnvironment (packages/meteor.js:1176:24)
I20170801-10:37:06.229(8)? - - - - -
I20170801-10:37:06.230(8)? at SMTPConnection._formatError (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:528:15)
I20170801-10:37:06.230(8)? at SMTPConnection._actionMAIL (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:1252:30)
I20170801-10:37:06.230(8)? at SMTPConnection.<anonymous> (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:759:14)
I20170801-10:37:06.231(8)? at SMTPConnection._processResponse (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:669:16)
I20170801-10:37:06.231(8)? at SMTPConnection._onData (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:493:10)
I20170801-10:37:06.231(8)? at emitOne (events.js:77:13)
I20170801-10:37:06.232(8)? at TLSSocket.emit (events.js:169:7)
I20170801-10:37:06.232(8)? at readableAddChunk (_stream_readable.js:153:18)
I20170801-10:37:06.232(8)? at TLSSocket.Readable.push (_stream_readable.js:111:10)
I20170801-10:37:06.233(8)? at TLSWrap.onread (net.js:537:20)
My code:
if(response === 1) {
sendDeferredEmail({
to: email,
from: "smtp#***.com",
subject: "New Travel Request pending response by " + user.username,
html: user.username + " added a new travel request." + "<br>"
});
...
function sendDeferredEmail(params)
{
try {
Meteor.defer(function () {
Email.send({to: params.to, from: params.from, subject: params.subject, html: params.html});
});
}
catch(e)
{
console.log("Caught exception when sending email:\n" + e);
}
}
The email setup:
process.env.MAIL_URL = 'smtp://smtp#***:587';
What is going wrong here and how can I fix it?
I would comment but lack reputation... How fast are you pressing the buttons? Most online mail servers don't allow relay sends to avoid users spamming. Have you tried setting this as a server side function and using Meteor.call() to trigger an Email.send()?

OrientDB.RequestError: Cannot find a command executor for the command request: sql.#11.1

I am experimenting with OrientDB (community edition v1.7-rc2) / Oriento (0.4.0)
The function
function linkChildToParent(oChild, oParent) {
return (
oDB.edge.from(oChild).to(oParent)
.create({"#class": 'OrgUnit_isPartOf_OrgUnit'})
.tap(log)
.return(oChild)
);
}
Fails with an exception
C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\node_modules\bluebird\js\main\async.js:93
throw res.e;
^
OrientDB.RequestError: Cannot find a command executor for the command request: sql.#11.1
at Operation.parseError (C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\lib\transport\binary\protocol\operation.js:806:13)
at Operation.consume (C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\lib\transport\binary\protocol\operation.js:396:35)
at Connection.process (C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\lib\transport\binary\connection.js:324:17)
at Connection.handleSocketData (C:\Users\Udo\workspace\NodeOrient\node_modules\oriento\lib\transport\binary\connection.js:250:17)
at Socket.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:764:14)
at Socket.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:426:10)
at emitReadable (_stream_readable.js:422:5)
at readableAddChunk (_stream_readable.js:165:9)
From previous event:
at Function.Promise$All [as all] (C:\Users\Udo\workspace\NodeOrient\node_modules\bluebird\js\main\promise.js:193:12)
at generateDependents (C:\Users\Udo\workspace\NodeOrient\setupOrgDB.js:202:35)
From previous event:
at Function.Promise$Join [as join] (C:\Users\Udo\workspace\NodeOrient\node_modules\bluebird\js\main\join.js:118:15)
at BinaryTransport.populateDB (C:\Users\Udo\workspace\NodeOrient\setupOrgDB.js:219:20)
So I debugged into the driver till I found
function createEdge (db, config, from, to) {
var command = "CREATE EDGE",
className, attributes;
config = edgeConfig(config);
className = config[0];
attributes = config[1];
command += ' ' + className + ' FROM ' + edgeReference(from) + ' TO ' + edgeReference(to);
if (attributes) {
command += ' CONTENT ' + JSON.stringify(attributes);
}
return db.query(command);
}
The content of command right before return db.query(command); is
CREATE EDGE OrgUnit_isPartOf_OrgUnit FROM (#11.1) TO (#11.0)
I then used the (browser based) console to verify that OrgUnit_isPartOf_OrgUnit actually inherits from Edge. I also verified that it will link OrgUnit with OrgUnit Vertices and that OrgUnit is derived from Vertex. I also double verified that records #11.1 and #11.0 are actually present in the database.
Then I issued
CREATE EDGE OrgUnit_isPartOf_OrgUnit FROM (#11.1) TO (#11.0)
directly in the console and got
com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.#11:1
This is basically the same exception. With Google I found some Javadoc for this exception. However this did not help me at all.
What is wrong and how can I fix it?
The right command should be without parenthesis. Parenthesis executes sub-queries:
CREATE EDGE OrgUnit_isPartOf_OrgUnit FROM #11:1 TO #11:0
For more information look at Create Edge command.

Nodejs-mongoose-0.0.5 error when run app.js

/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/util.js:40
continue;
^^^^^^^^
node.js:68
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Illegal continue statement
at Module._compile (node.js:418:29)
at Object..js (node.js:429:14)
at Module.load (node.js:355:35)
at Function._load (node.js:322:14)
at require (node.js:367:23)
at Object.<anonymous> (/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/model.js:2:13)
at Module._compile (node.js:423:30)
at Object..js (node.js:429:14)
at Module.load (node.js:355:35)
at Function._load (node.js:322:14)
And the code is just:
var mongoose = require('mongoose').Mongoose;
mongoose.model('User', {
properties: ['user', 'pass', 'widgets' ],
indexes: [ { 'user' : 1 } , { unique : true } ],
});
.......
/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/util.js:40
else {
// Prevent never-ending loop
if (target === d.value) {
continue;
}
even if i comment the continue statement, causes another error log:
node.js:68
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ECONNREFUSED, Connection refused
at Socket._onConnect (net.js:548:18)
at IOWatcher.onWritable [as callback] (net.js:165:12)
Any idea?
/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/util.js
Edit this file and change line 40 from continue; to return;
In Array.prototype.forEach, continue is not supported (you can use the example below to test return vs continue in firebug's console)
[1,2,3,4].forEach(function(val, arr) {
if(val != 1) {
console.log(val);
return;
//continue;
}
console.log('here');
});
ECONNREFUSED is because your mongod is not running - where's the connect string?