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
Related
I am using request to access data from an api. sometimes, when the api Url is down, node throws error and shuts down with the following error
`at ClientRequest.emit (events.js:315:20)`
`at TLSSocket.socketErrorListener (_http_client.js:426:9)`
`at TLSSocket.emit (events.js:315:20)`
`at emitErrorNT (internal/streams/destroy.js:92:8)`
`at processTicksAndRejections (internal/process/task_queues.js:84:21)
errno: 'ENOTFOUND',
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: APIURL
is there any way to handle this and prevent node from exiting?
my code is
const JSONdata= ()=>{
request({url:API_URL2,json:true},(error,response,body)=>{
const data=[]
var jsondata=body
data.push(jsondata)
const data2=JSON.stringify(data)
fs.writeFile('sample.txt',data2,(err) => { if(error){console.log(error} })})
having a try-catch will prevent failure or system crash, also you get process.uncaughtException() to do something when the system crashes
check below link for more details
https://nodejs.org/api/process.html#process_event_uncaughtexception
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.
I'm posting some sample data to my Smee endpoint and I am also running a local instance of my ProBot app. I get a bad request in my bot logs and I see this is the Smee response:
{ Error: cannot POST / (400)
at Response.toError (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/node/response.js:94:15)
at ResponseBase._setStatusProperties (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/response-base.js:123:16)
at new Response (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/node/response.js:41:8)
at Request._emitResponse (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/node/index.js:752:20)
at IncomingMessage.parser (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/node/index.js:916:38)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
status: 400,
text: 'Required headers missing: x-github-event, x-github-delivery',
method: 'POST',
path: '/' },
How can I get these header values to test with in my app? Not sure if it's me, but the documentation doesn't note this anywhere
I used https://www.freeformatter.com/hmac-generator.html#ad-output to throw in the payload as the body and my secret and the hash was valid!
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 `...