I got an error when try to migrate tables which are created using seguelizeCLI in node js,and when i change version of node js i also got different error message
1.this when i use stable node v9
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be one of type string, TypedArray, or DataView
at Hash.update (internal/crypto/hash.js:53:11)
at sha1 (/home/dontito/NodeORMs/node_modules/mysql2/lib/auth_41.js:30:8)
at Object.token [as calculateToken] (/home/dontito/NodeORMs/node_modules/mysql2/lib/auth_41.js:64:16)
at new HandshakeResponse (/home/dontito/NodeORMs/node_modules/mysql2/lib/packets/handshake_response.js:28:24)
at ClientHandshake.sendCredentials (/home/dontito/NodeORMs/node_modules/mysql2/lib/commands/client_handshake.js:51:27)
at ClientHandshake.handshakeInit (/home/dontito/NodeORMs/node_modules/mysql2/lib/commands/client_handshake.js:142:10)
at ClientHandshake.Command.execute (/home/dontito/NodeORMs/node_modules/mysql2/lib/commands/command.js:40:20)
at Connection.handlePacket (/home/dontito/NodeORMs/node_modules/mysql2/lib/connection.js:502:28)
at PacketParser.onPacket (/home/dontito/NodeORMs/node_modules/mysql2/lib/connection.js:81:16)
at PacketParser.executeStart (/home/dontito/NodeORMs/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket.<anonymous> (/home/dontito/NodeORMs/node_modules/mysql2/lib/connection.js:89:29)
at Socket.emit (events.js:127:13)
at addChunk (_stream_readable.js:269:12)
at readableAddChunk (_stream_readable.js:256:11)
at Socket.Readable.push (_stream_readable.js:213:10)
at TCP.onread (net.js:590:20)
2.when i turn to other node version like v4
crypto.js:100
this._handle.update(data, encoding);
^
TypeError: Not a string or buffer
at TypeError (native)
at Hash.update (crypto.js:100:16)
at sha1 (/home/dontito/NodeORMs/node_modules/mysql2/lib/auth_41.js:30:8)
at Object.token [as calculateToken] (/home/dontito/NodeORMs/node_modules/mysql2/lib/auth_41.js:64:16)
at new HandshakeResponse (/home/dontito/NodeORMs/node_modules/mysql2/lib/packets/handshake_response.js:28:24)
at ClientHandshake.sendCredentials (/home/dontito/NodeORMs/node_modules/mysql2/lib/commands/client_handshake.js:51:27)
at ClientHandshake.handshakeInit (/home/dontito/NodeORMs/node_modules/mysql2/lib/commands/client_handshake.js:142:10)
at ClientHandshake.Command.execute (/home/dontito/NodeORMs/node_modules/mysql2/lib/commands/command.js:40:20)
at Connection.handlePacket (/home/dontito/NodeORMs/node_modules/mysql2/lib/connection.js:502:28)
at PacketParser.onPacket (/home/dontito/NodeORMs/node_modules/mysql2/lib/connection.js:81:16)
at PacketParser.executeStart (/home/dontito/NodeORMs/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket.<anonymous> (/home/dontito/NodeORMs/node_modules/mysql2/lib/connection.js:89:29)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
You should change your password in config file like abc → "abc"
Related
I am trying to run todo list example in loopback 4. I use MySql as the backend db on a different server. The problem I am facing is while I could connect to the database from MySql Workbench, I get the following error when I try making the db connection from loopback 4 using the same credentials.
Any help is appreciated.
Connection fails: Error: ER_DBACCESS_DENIED_ERROR: Access denied for user 'dev1'#'%' to database 'todo'
It will be retried for the next request.
C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\sequences\Sequence.js:47
var err = new Error(code + ': ' + packet.message);
^
Error: ER_DBACCESS_DENIED_ERROR: Access denied for user 'dev1'#'%' to database 'todo'
at Handshake.Sequence._packetToError (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
at Handshake.ErrorPacket (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18)
at Protocol._parsePacket (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\Parser.js:433:10)
at Parser.write (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\Parser.js:43:10)
at Protocol.write (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\Protocol.js:38:16)
at Socket.<anonymous> (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\Connection.js:91:28)
at Socket.<anonymous> (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\Connection.js:525:10)
at Socket.emit (events.js:210:5)
at addChunk (_stream_readable.js:309:12)
at readableAddChunk (_stream_readable.js:290:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead (internal/stream_base_commons.js:182:23)
--------------------
at Protocol._enqueue (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at PoolConnection.connect (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\Connection.js:119:18)
at Pool.getConnection (C:\Users\rames\GitHub\todo-list\node_modules\mysql\lib\Pool.js:48:16)
at MySQL.connect (C:\Users\rames\GitHub\todo-list\node_modules\loopback-connector-mysql\lib\mysql.js:90:17)
at Object.initializeDataSource [as initialize] (C:\Users\rames\GitHub\todo-list\node_modules\loopback-connector-mysql\lib\mysql.js:44:28)
at DbDataSource.DataSource.setup (C:\Users\rames\GitHub\todo-list\node_modules\loopback-datasource-juggler\lib\datasource.js:513:19)
at new DataSource (C:\Users\rames\GitHub\todo-list\node_modules\loopback-datasource-juggler\lib\datasource.js:145:8)
at new DbDataSource (C:\Users\rames\GitHub\todo-list\src\datasources\db.datasource.ts:20:5)
at C:\Users\rames\GitHub\todo-list\node_modules\#loopback\context\src\resolver.ts:73:14
at Object.transformValueOrPromise (C:\Users\rames\GitHub\todo-list\node_modules\#loopback\context\src\value-promise.ts:270:12)
at Object.instantiateClass (C:\Users\rames\GitHub\todo-list\node_modules\#loopback\context\src\resolver.ts:66:35)
at C:\Users\rames\GitHub\todo-list\node_modules\#loopback\context\src\binding.ts:533:29
at Binding._getValue (C:\Users\rames\GitHub\todo-list\node_modules\#loopback\context\src\binding.ts:410:14)
at C:\Users\rames\GitHub\todo-list\node_modules\#loopback\context\src\binding.ts:305:23
at C:\Users\rames\GitHub\todo-list\node_modules\#loopback\context\src\resolution-session.ts:114:13
I noticed there was a typo in database name in the connection string. I fixed it and I am able to connect now.
#jaromanda Thank you.
getting error:While implementing ethereum blockchain code ,
error that i am getting is :Invalid JSON RPC response while using INFURA
Attaching error log below kindly help
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/home/joshi/Desktop/inbox/node_modules/truffle-hdwallet-provider/node_modules/web3/lib/web3/errors.js:35:16)
at XMLHttpRequest.request.onreadystatechange (/home/joshi/Desktop/inbox/node_modules/truffle-hdwallet-provider/node_modules/web3/lib/web3/httpprovider.js:115:32)
at XMLHttpRequestEventTarget.dispatchEvent (/home/joshi/Desktop/inbox/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/home/joshi/Desktop/inbox/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpRequestError (/home/joshi/Desktop/inbox/node_modules/xhr2/lib/xhr2.js:544:12)
at ClientRequest.<anonymous> (/home/joshi/Desktop/inbox/node_modules/xhr2/lib/xhr2.js:414:24)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
If you don't post more information, such as a little piece of code is difficult to understand what is happening.
What you should try is this:
In every link to infura api remove the "/v3" part from the url.
From this:
const provider = new HDWalletProvider(mnemonic,
'https://rinkeby.infura.io/v3/project_id');
To this:
const provider = new HDWalletProvider(mnemonic,
'https://rinkeby.infura.io/project_id');
Hope this helps.
Don't use www and /v3 in infura API URI and it's required to use https in the URI. eg.
https://rinkeby.infura.io/project_id
im using heroku to host my site however it keeps spitting out the same error which is
2018-05-06T19:28:52.212104+00:00 app[web.1]:AssertionError [ERR_ASSERTION]: false == true
2018-05-06T19:28:52.212106+00:00 app[web.1]:at Object.exports.connect (_tls_wrap.js:1036:3)
2018-05-06T19:28:52.212107+00:00 app[web.1]: at Socket. (/app/node_modules/pg/lib/connection.js:94:23)
2018-05-06T19:28:52.212109+00:00 app[web.1]:at Object.onceWrapper (events.js:315:30)
2018-05-06T19:28:52.212110+00:00 app[web.1]:at emitOne (events.js:116:13)
2018-05-06T19:28:52.212112+00:00 app[web.1]: at Socket.emit (events.js:211:7)
2018-05-06T19:28:52.212113+00:00 app[web.1]:at addChunk (_stream_readable.js:263:12)
2018-05-06T19:28:52.212115+00:00 app[web.1]:at readableAddChunk (_stream_readable.js:250:11)
2018-05-06T19:28:52.212116+00:00 app[web.1]:at Socket.Readable.push (_stream_readable.js:208:10)
2018-05-06T19:28:52.212118+00:00 app[web.1]: at TCP.onread >>(net.js:607:20)
this is how im connecting (taken straight off of herokus website)
const { Client } = require("pg");
const router = express.Router();
const pool = new Client({
connectionString: process.env.DATABASE_URL,
ssl: true,
});
pool.connect();
I found out what the error was:
the error was that i did not have a db create. i decided to use elephantSQL and from their i connected to elephantSQL with pgadmin and recreated my database. it works perfect now
to see how this works see : https://www.elephantsql.com/docs/pgadmin.html
im more than happy to answer some questions
OK, this isn't really a solution but it might help you out. This happens to me on node 8 (and 10) but when I downgraded to node 7 it seems to work fine. I'll be watching this post to see if someone comes up with a better fix.
I'm trying to create a simple web app using sailsjs. I'd like to use a neo4j database and I've found only this adapter: https://github.com/natgeo/sails-neo4j/
I try to add the adpter configuration in connection.js using mostly of default value (as I've a default installation):
neo4jServer: {
adapter: 'sails-neo4j'
//protocol: 'http://',
//port: 7474,
//host: 'localhost',
//base: '/db/data/',
//debug: false }
and specifing it in my model.js file:
connection: 'neo4jServer',
but I've this error (not so explicit..) if I try to lift up the server (I don't have any logic yet, I only created a couple of model using api generation):
C:\WS\SAILS\testProject\node_modules\sails-neo4j\lib\connection.js:15
throw err;
^ Error
at ClientRequest.<anonymous> (C:\WS\SAILS\testProject\node_modules\sails-neo4j\node_modules\neo4j-js\lib\Neo4jApi.js:227:13)
at ClientRequest.g (events.js:260:16)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at HTTPParser.parserOnIncomingClient (_http_client.js:415:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
at Socket.socketOnData (_http_client.js:305:20)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
Does anyone use it? How can be configured in order to make it works? I'm using sailsjs 0.11.3
Thanks,
Michele.
If using authentication with Neo4j, be sure to specify the credentials. You can do this in the host property of the config object for the sails adapter (Neo4j uses Basic Authentication):
neo4jServer: {
adapter: 'sails-neo4j'
protocol: 'http://',
port: 7474,
host: 'username:password#localhost',
base: '/db/data/',
debug: false
}
or disable Neo4j authentication by setting dbms.security.auth_enabled=false in conf/neo4j-server.properties
After running node for a long time I get this error.
My program itself works perfectly fine.
What does it really mean? I can't find anything about it.
And most importantly how to prevent it?
Error: read ETIMEDOUT
at errnoException (net.js:901:11)
at TCP.onread (net.js:556:19)
--------------------
at Query.Sequence (/nodejs/node_modules/mysql/lib/protocol/sequences/Sequence.js:15:20)
at new Query (/nodejs/node_modules/mysql/lib/protocol/sequences/Query.js:12:12)
at Function.Connection.createQuery (/nodejs/node_modules/mysql/lib/Connection.js:48:10)
at Connection.query (/nodejs/node_modules/mysql/lib/Connection.js:100:26)
at Socket.<anonymous> (/nodejs/server.js:23:12)
at Socket.EventEmitter.emit [as $emit] (events.js:95:17)
at SocketNamespace.handlePacket (/nodejs/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/nodejs/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/nodejs/node_modules/socket.io/lib/transport.js:387:20)
at Parser.<anonymous> (/nodejs/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)
I guess it has to do something with the mysql I'm using in my program because it refers to Query.sequence or something.
https://github.com/felixge/node-mysql
The only line I can refer to that causes this error is where I create a query:
database.query("SELECT * FROM `...