So Im getting this error:
[18:12:49:550] Message: "SEND items to user."
confirmTrade() received 1 confirmations
confirmTrade(): true
[18:13:8:154] Message: "Send all game number, jackpot 0"
[18:13:8:155] Message: "Starting to send informers for each socket"
[18:13:8:163] Message: "Send all "start-game""
undefined:1
<!doctype html>
^
SyntaxError: Unexpected token <
at Object.parse (native)
at Request._callback (/home/bot/bot.js:476:20)
at Request.self.callback (/home/bot/node_modules/request/request.js:354:22)
at Request.emit (events.js:110:17)
at Request.<anonymous> (/home/bot/node_modules/request/request.js:1207:14)
at Request.emit (events.js:129:20)
at IncomingMessage.<anonymous> (/home/bot/node_modules/request/request.js:1153:12)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)
Any ideas?
It seems as if you tried to run an html file with Node.js. Don't.
Related
I'm trying to build my first project using androidjs
I'm getting the following error message
Failed to create assets Error: EEXIST: file already exists, mkdir 'C:\Users\BenjaminShumway\.androidjs\cache\androidjs-sdk\assets\myapp'
at Object.mkdirSync (node:fs:1395:3)
at Webview.updateFiles (C:\Users\BenjaminShumway\AppData\Roaming\npm\node_modules\androidjs-builder\modules\webview.js:320:20)
at C:\Users\BenjaminShumway\AppData\Roaming\npm\node_modules\androidjs-builder\modules\webview.js:511:26
at Request.<anonymous> (C:\Users\BenjaminShumway\AppData\Roaming\npm\node_modules\androidjs-builder\modules\webview.js:663:17)
at Request.emit (node:events:525:35)
at IncomingMessage.<anonymous> (C:\Users\BenjaminShumway\AppData\Roaming\npm\node_modules\androidjs-builder\node_modules\request\request.js:1076:12)
at Object.onceWrapper (node:events:627:28)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4075,
syscall: 'mkdir',
code: 'EEXIST',
path: 'C:\\Users\\BenjaminShumway\\.androidjs\\cache\\androidjs-sdk\\assets\\myapp'
}
I have installed the npm azure-storage package.
On Azure I have created a Storage Account and a container.
I then try to create an Append Blob:
const azure = require('azure-storage');
const service = azure.createBlobService("[ACCOUNT]", "[KEY]");
service.createAppendBlobFromText("[CONTAINER]",
"some-blob-name",
"some-text",
{},
(err, result) => {
console.log('err ->',err);
console.log('result ->',result);
});
The result of calling this is:
err -> { Error
at Function.StorageServiceClient._normalizeError (/[REMOVED]/node_modules/azure-storage/lib/common/services/storageserviceclient.js:1191:23)
at BlobService.StorageServiceClient._processResponse (/[REMOVED]/node_modules/azure-storage/lib/common/services/storageserviceclient.js:738:50)
at Request.processResponseCallback [as _callback] (/[REMOVED]/node_modules/azure-storage/lib/common/services/storageserviceclient.js:311:37)
at Request.self.callback (/[REMOVED]/node_modules/request/request.js:186:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (/[REMOVED]/node_modules/request/request.js:1163:10)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at IncomingMessage.<anonymous> (/[REMOVED]/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:314:30)
at emitNone (events.js:110:20)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1045:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'StorageError',
message: 'Append blobs are not supported.\nRequestId:ed1777f4-601c-00cf-19a0-bb77ba000000\nTime:2018-03-14T14:25:50.8138962Z',
code: 'BlobTypeNotSupported',
statusCode: 400,
requestId: 'ed1777f4-601c-00cf-19a0-bb77ba000000' }
result -> null
I have not been able to find anything, when searching for the error.
Am I missing something here?
Please check the redundancy kind of the storage account in which you're trying to create this blob.
Blob type support varies by the storage account redundancy kind.
For example, ZRS Classic redundancy kind of storage account only supports Block Blob while Premium LRS redundancy kind of storage account only supports Page Blob.
I'm getting the following error when trying to run the following code. My goal is to delete all items in both the User and Item tables. User and Item correspond to Dynamoose models.
The for loop is running correctly. But the scan().exec callback function isn't being run at all and it's throwing the following error.
What is really strange is on CircleCI this problem doesn't happen. It only happens on my local computer. I have tried removing node_modules and running npm install with no luck. Also it works fine if I remove the code below.
Any ideas? Or even where to start debugging this?
Code:
var dbarray = [User, Item];
for (var i = 0; i < dbarray.length; i++) {
dbarray[i].scan().exec(function(err, items) {
if (err) {
throw err;
}
items.forEach(function(item, key) {
item.delete();
});
});
}
Error:
General
1) "before each" hook
0 passing (10s)
1 failing
1) "before each" hook:
Uncaught NetworkingError: Cannot read property 'replace' of undefined
at findTargetPort (node_modules/zombie/lib/reroute.js:50:28)
at Socket.Net.Socket.connect (node_modules/zombie/lib/reroute.js:69:18)
at Agent.connect [as createConnection] (net.js:106:35)
at Agent.createSocket (_http_agent.js:217:26)
at Agent.addRequest (_http_agent.js:187:10)
at new ClientRequest (_http_client.js:272:16)
at Object.request (http.js:39:10)
at features.constructor.handleRequest (node_modules/aws-sdk/lib/http/node.js:42:23)
at executeSend (node_modules/aws-sdk/lib/event_listeners.js:304:29)
at Request.SEND (node_modules/aws-sdk/lib/event_listeners.js:318:9)
at Request.callListeners (node_modules/aws-sdk/lib/sequential_executor.js:101:18)
at Request.emit (node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (node_modules/aws-sdk/lib/state_machine.js:14:12)
at node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at callNextListener (node_modules/aws-sdk/lib/sequential_executor.js:95:12)
at node_modules/aws-sdk/lib/event_listeners.js:220:9
at finish (node_modules/aws-sdk/lib/config.js:315:7)
at node_modules/aws-sdk/lib/config.js:333:9
at Credentials.get (node_modules/aws-sdk/lib/credentials.js:126:7)
at getAsyncCredentials (node_modules/aws-sdk/lib/config.js:327:24)
at Config.getCredentials (node_modules/aws-sdk/lib/config.js:347:9)
at Request.SIGN (node_modules/aws-sdk/lib/event_listeners.js:192:22)
at Request.callListeners (node_modules/aws-sdk/lib/sequential_executor.js:101:18)
at Request.emit (node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (node_modules/aws-sdk/lib/state_machine.js:14:12)
at node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at Timeout.callNextListener [as _onTimeout] (node_modules/aws-sdk/lib/sequential_executor.js:95:12)
The issue turned out to be with Zombie.js. Specially Browser.localhost('localhost', port);. Removing that line and passing in http://localhost:3000 before each visit command solved the problem.
Not sure why the error was mentioning AWS and things like that.
I'm trying to run test of the hyperledger fabric client node but I have some issues. Indeed, when I run the command gulp test I have lots of errors which look like this:
not ok 586 Error: SERVICE_UNAVAILABLE at ClientDuplexStream.<anonymous> (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_
modules\fabric-client\lib\Orderer.js:9:4530) at emitOne (events.js:96:13) at ClientDuplexStream.emit (events.js:188:7) at ClientDuplexStream.
_emitStatusIfDone (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\client.js:204:12) at ClientD
uplexStream._readsDone (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\client.js:169:8) at rea
dCallback (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\client.js:229:12)
---
operator: fail
at: Client.newDefaultKeyValueStore.then.then.then.then.then.then (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\test\int
egration\e2e\create-channel.js:211:5)
stack: |-
Error: Error: SERVICE_UNAVAILABLE
at ClientDuplexStream.<anonymous> (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\fabric-client\lib\Or
derer.js:9:4530)
at emitOne (events.js:96:13)
at ClientDuplexStream.emit (events.js:188:7)
at ClientDuplexStream._emitStatusIfDone (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\
src\client.js:204:12)
at ClientDuplexStream._readsDone (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\cli
ent.js:169:8)
at readCallback (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\client.js:229:12)
at Test.assert [as _assert] (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\tape\lib\test.js:212:54)
at Test.bound [as _assert] (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\tape\lib\test.js:64:32)
at Test.fail (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\tape\lib\test.js:277:10)
at Test.bound [as fail] (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\tape\lib\test.js:64:32)
at Client.newDefaultKeyValueStore.then.then.then.then.then.then (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\tes
t\integration\e2e\create-channel.js:211:5)
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
I think this is due to an error of connexion between the tests and the containers but I don't understand what I have to do in order to solve it. So if someone had this error before, please share the solution ;) Thanks !
I am using the Instagram API to search for a specific tag and then display the first result's image. Here I am using the JSON.parse() function parse the JSON that comes back from making a http get request to https://api.instagram.com/v1/tags/{tag}/media/recent?access_token={access token}. Here is what the request is returning me (- everything that doesn't matter). Note: I blanked out parts of the URL's, assume that they are correct.
{
"data":[
{
"images":{
"low_resolution":{
"url":"https://scontent.cdninstagram.com/t51.2885-15/s320x320/e35/--------_--------6248_1327489376_n.jpg?ig_cache_key=--------",
"width":320,
"height":320
},
"thumbnail":{
"url":"https://scontent.cdninstagram.com/t51.2885-15/s150x150/e35/--------_--------6248_1327489376_n.jpg?ig_cache_key=--------",
"width":150,
"height":150
},
"standard_resolution":{
"url":"https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/--------_--------6248_1327489376_n.jpg?ig_cache_key=--------",
"width":640,
"height":640
}
}
}
]
}
Here is the code I am using to make the request and parse the JSON:
request.get("https://api.instagram.com/v1/tags/" + tag + "/media/recent?access_token=" + accessToken, function(error, response, body)
{
console.log(JSON.parse(body).data.images.standard_resolution.url)
});
});
When ever I run this code it gives me this error:
/Users/pjtnt11/Documents/NodeJs/Instagram/index.js:52
console.log(JSON.parse(body).data.images.standard_resolution.url)
^
TypeError: Cannot read property 'images' of undefined
at Request._callback (/Users/pjtnt11/Documents/NodeJs/Instagram/index.js:52:67)
at Request.self.callback (/Users/pjtnt11/Documents/NodeJs/Instagram/node_modules/request/request.js:187:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/Users/pjtnt11/Documents/NodeJs/Instagram/node_modules/request/request.js:1044:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/Users/pjtnt11/Documents/NodeJs/Instagram/node_modules/request/request.js:965:12)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
I thought that maybe it could have been because console.log() was running before JSON.parse() but JSON.parse blocks the code from running anything else. I also check if it had a callback or a promise that I could use but I didn't see anything.
Now I have no idea what is going on. Does anyone know what could be causing this error and how I could fix it?
EDIT:
Okay, so I found out that data is a data array, so I need to change my code to be data[0] the problem now is I get the following error when I run the code:
/Users/pjtnt11/Documents/NodeJs/Instagram/index.js:52
console.log(JSON.parse(body).data[0].images.standard_resolution.url)
^
TypeError: Cannot read property '0' of undefined
at Request._callback (/Users/pjtnt11/Documents/NodeJs/Instagram/index.js:52:67)
at Request.self.callback (/Users/pjtnt11/Documents/NodeJs/Instagram/node_modules/request/request.js:187:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/Users/pjtnt11/Documents/NodeJs/Instagram/node_modules/request/request.js:1044:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/Users/pjtnt11/Documents/NodeJs/Instagram/node_modules/request/request.js:965:12)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
data is an Array, so you need to access the first element...
JSON.parse(body).data[0].images
see following working snippet...
var someObject = '{ \
"data":[ \
{ \
"images":{ \
"low_resolution":{ \
"url":"https://scontent.cdninstagram.com/t51.2885-15/s320x320/e35/--------_--------6248_1327489376_n.jpg?ig_cache_key=--------", \
"width":320, \
"height":320 \
}, \
"thumbnail":{ \
"url":"https://scontent.cdninstagram.com/t51.2885-15/s150x150/e35/--------_--------6248_1327489376_n.jpg?ig_cache_key=--------", \
"width":150, \
"height":150 \
}, \
"standard_resolution":{ \
"url":"https://scontent.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/--------_--------6248_1327489376_n.jpg?ig_cache_key=--------", \
"width":640, \
"height":640 \
} \
} \
} \
] \
}';
console.log(JSON.parse(someObject).data[0].images.low_resolution.url);