I'm facing an issue when trying to bring up the Hyperledger Explorer app. I followed instructions stated in here but I'm still unsuccessful on trying to bring up the app.
My config.json file looks like this:
{
"network-configs": {
"network-1": {
"version": "1.0",
"clients": {
"client-1": {
"tlsEnable": true,
"organization": "Org1MSP",
"channel": "mychannel",
"credentialStore": {
"path": "./tmp/credentialStore_Org1/credential",
"cryptoStore": {
"path": "./tmp/credentialStore_Org1/crypto"
}
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer0.org1.example.com": {}
},
"connection": {
"timeout": {
"peer": {
"endorser": "6000",
"eventHub": "6000",
"eventReg": "6000"
}
}
}
}
},
"certificateAuthorities":{
"ca_peerOrg1":{},
"ca_peerOrg2":{}
},
"organizations": {
"Org1MSP": {
"mspid": "Org1MSP",
"fullpath": false,
"adminPrivateKey": {
"path": "/home/rodolfo/fabric-sample-with-kafka/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/keystore"
},
"signedCert": {
"path": "/home/rodolfo/fabric-sample-with-kafka/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/signcerts"
},
"certificateAuthorities": {
"ca_peerOrg1":{
"url":"grpcs://localhost:7054"
}
}
},
"Org2MSP": {
"mspid": "Org2MSP",
"adminPrivateKey": {
"path": "/home/rodolfo/fabric-sample-with-kafka/first-network/crypto-config/peerOrganizations/org2.example.com/users/Admin#org2.example.com/msp/keystore"
},
"certificateAuthorities": {
"ca_peerOrg2":{
"url":"grpcs://localhost:8054"
}
}
},
"OrdererMSP": {
"mspid": "OrdererMSP",
"adminPrivateKey": {
"path": "/home/rodolfo/fabric-sample-with-kafka/first-network/crypto-config/ordererOrganizations/example.com/users/Admin#example.com/msp/keystore"
}
}
},
"peers": {
"peer0.org1.example.com": {
"tlsCACerts": {
"path": "/home/rodolfo/fabric-sample-with-kafka/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
},
"url": "grpcs://localhost:7051",
"eventUrl": "grpcs://localhost:7053",
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com"
}
},
"peer1.org1.example.com": {
"url": "grpcs://localhost:8051"
},
"peer0.org2.example.com": {
"url": "grpcs://localhost:9051"
},
"peer1.org2.example.com": {
"url": "grpcs://localhost:10051"
}
},
"orderers": {
"orderer0.example.com": {
"url": "grpcs://localhost:7050"
},
"orderer1.example.com": {
"url": "grpcs://localhost:8050"
}
}
},
"network-2": {}
},
"configtxgenToolPath": "/home/rodolfo/fabric-sample-with-kafka/bin",
"license": "Apache-2.0"
}
My explorerconfig.json file:
{
"persistence": "postgreSQL",
"platforms": ["fabric"],
"postgreSQL": {
"host": "127.0.0.1",
"port": "5432",
"database": "fabricexplorer",
"username": "rodolfo",
"passwd": ""
},
"sync": {
"type": "local",
"platform": "fabric",
"blocksSyncTime": "3"
}
}
The errors I'm getting in the logs are:
postgres://rodolfo:#127.0.0.1:5432/fabricexplorer
error when connecting to db: { error: password authentication failed
for user "rodolfo"...
<<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>
TypeError: Cannot read property 'port' of undefined
at Timeout.handleDisconnect [as _onTimeout] (/home/rodolfo/blockchain-
explorer/app/persistence/postgreSQL/pgservice.js:48:32)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
Please open web browser to access :http://localhost:8080/
pid is 10774
TypeError: Cannot read property 'port' of undefined
at Timeout.handleDisconnect [as _onTimeout] (/home/rodolfo/blockchain-
explorer/app/persistence/postgreSQL/pgservice.js:48:32)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
<<<<<<<<<<<<<<<<<<<<<<<<<< Closing client processor
>>>>>>>>>>>>>>>>>>>>>
Already tried changing the password for my user on PSQL and modify it on the explorerconfig.json but same error shows up. Tried using blank password and still error shows. Any guidance would be greatly appreciated.
Related
Any help would be greatly appreciated. Also, I would like to thank you in advance!
When trying to create the autorest client I am getting the following error, but I cannot figure out how to resolve it. The Web API is a 3rd party API and we cannot change it. I am trying to target net6.0.
Autorest Command:
autorest --csharp --input-file=swagger_doc.json --namespace=MyNameSpace --output-folder=AutoRest --override-client-name=WeatherAPIClient .\custom-config.json --v3
Error Details:
info | AutoRest core version selected from configuration: ^3.2.0.
info | Loading AutoRest core 'C:\Users\dfazekas.autorest#autorestcore#3.9.4\nodemodules#autorest\core\dist' (3.9.4)
info | Loading AutoRest extension '#autorest/csharp' (latest->3.0.0-beta.20230115.1)
info | Loading AutoRest extension '#autorest/modelerfour' (4.25.0->4.25.0)
error | InvalidRef | Ref '#/components/schemas/Microsoft.AspNetCore.JsonPatch.Operations.Operation' is not referencing a valid location. paths,/Item/{Id},patch,requestBody,content,application/json-patch+json,schema,items
- file:///C:/SHI/source/myapp/MyNameSpace.WeatherAPIClient/swagger_doc.json:1211:17
Swagger Doc from error:
"/Item/{Id}": {
"patch": {
"tags": [
"Item"
],
"summary": "Update one or more fields of a resource",
"description": "Update one or more fields of a resource",
"parameters": [
{
"name": "Id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"requestBody": {
"content": {
"application/json-patch+json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Microsoft.AspNetCore.JsonPatch.Operations.Operation"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Microsoft.AspNetCore.JsonPatch.Operations.Operation"
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success"
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
}
}
}
},
"500": {
"description": "Server Error"
}
}
}
},
I have a strange thing going on in my Alexa skill. My skill requires to connect with MongoDB and save data. Whenever I connect to database, Alexa is giving me this response: "There was a problem with the requested skill's response". It is completely weired because few days ago my database and Alexa skill were perfectly working. Now, suddenly, I don't get any response from Alexa even though my database in connected and creats documents.
Below is my JSON INPUT and code from the Launchrequesthandler :
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.b163d6da-ab3d-483c-ba19-60156810739c",
"application": {
"applicationId": "amzn1.ask.skill.bd7f1ea6-53ab-41af-9a59-4853d4906373"
},
"user": {
"userId": "amzn1.ask.account.AFMYVNKRB3REUKGDDLGIFOYXR53ISFLYHQJXHO2YDRYVQCPCRLYQFIVLBE5HDXH6FNMTMN4YLXHR6ZMSJEFQ3Y2BRI76N2FHSHDXAWUPVFB6JKWSRTPA7EWOH6ZOF24KY5DXUBA3UMUY3TNQZ42AOOFESTFWW6VLTU63AHHQMMPKA74M2WX66TN4IYOZUNLMBXMX3LCUBWPO4FY"
}
},
"context": {
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 213,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"mode": "HUB",
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1280,
"pixelHeight": 800
}
}
}
}
],
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 346,
"arcMinuteHeight": 216,
"canRotate": false,
"canResize": false
}
],
"mode": "HUB",
"shape": "RECTANGLE",
"pixelWidth": 1280,
"pixelHeight": 800,
"dpi": 213,
"currentPixelWidth": 1280,
"currentPixelHeight": 800,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Extensions": {
"available": {
"aplext:backstack:10": {}
}
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.bd7f1ea6-53ab-41af-9a59-4853d4906373"
},
"user": {
"userId": "amzn1.ask.account.AFMYVNKRB3REUKGDDLGIFOYXR53ISFLYHQJXHO2YDRYVQCPCRLYQFIVLBE5HDXH6FNMTMN4YLXHR6ZMSJEFQ3Y2BRI76N2FHSHDXAWUPVFB6JKWSRTPA7EWOH6ZOF24KY5DXUBA3UMUY3TNQ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J4rmW4UdzHA_lnH7543QhgU9t71JRncgEDKEsEcVgxs5biFR9il4W8ASfwuDeJhdy8HpiXZw"
}
},
"request": {
"type": "LaunchRequest",
"requestId": "amzn1.echo-api.request.3e29f996-69b2-4e90-bfef-628d74f57307",
"locale": "en-US",
"timestamp": "2021-07-19T02:06:14Z",
"shouldLinkResultBeReturned": false
}
}
//database connection//
const q="mongodb+srv://sumya:sumya123#mydata.acxs0.mongodb.net/Mydata?retryWrites=true&w=majority";
mongoose.connect(q,{ useNewUrlParser: true, useUnifiedTopology: true,useFindAndModify: false })
.then(() => console.log("Database connected!")
)
.catch(err => console.log(err))
const Alexa = require('ask-sdk-core');
const LaunchRequestHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest';
},
async handle(handlerInput) {
const speakOutput = 'Hi, I am Nao. I am here to give you counseling on your anxiety issues. Can I have your name, please? Note: We are not professional therapists or counselors. ';
const useri=handlerInput.requestEnvelope.session.user.userID;
const z=handlerInput.requestEnvelope.session.sessionId;
const g=Alexa.getUserId(handlerInput.requestEnvelope);
const curr_session=new post.session({
alexa_sessionid:z
});
let user=await post.findOne({userID:g});
if(!user){
user=new post({
userID:g
});
}
user.session_list.push(curr_session);
user.save();
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt(speakOutput)
.getResponse();
}
};
Here is the Log that I got from Cloudwatch.
START RequestId: 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 Version: 304
2021-07-19T16:40:00.570Z 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 INFO Database connected!
END RequestId: 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9
REPORT RequestId: 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 Duration: 8008.11 ms Billed Duration: 8000 ms Memory Size: 512 MB Max Memory Used: 102 MB Init Duration: 653.49 ms
2021-07-19T16:40:08.023Z 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 Task timed out after 8.01 seconds
START RequestId: 4e671447-8207-414e-aaf4-9a807fe3ac01 Version: 304
2021-07-19T16:40:08.894Z 4e671447-8207-414e-aaf4-9a807fe3ac01 INFO ~~~~ Session ended:
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.05ca6843-cdc8-47eb-9a5f-081942cf2674",
"application": {
"applicationId": "amzn1.ask.skill.bd7f1ea6-53ab-41af-9a59-4853d4906373"
},
"user": {
"userId": "amzn1.ask.account.AFMYVNKRB3REUKGDDLGIFOYXR53ISFLYHQJXHO2YDRYVQCPCRLYQFIVLBE5HDXH6FNMTMN4YLXHR6ZMSJEFQ3Y2BRI76N2FHSHDXAWUPVFB6JKWSRTPA7EWOH6ZOF24KY5DXUBA3UMUY3TNQZ42AOOFESTFWW6VLTU63AHHQMMPKA74M2WX66TN4IYOZUNLMBXMX3LCUBWPO4FY"
}
},
"context": {
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 213,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"mode": "HUB",
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1280,
"pixelHeight": 800
}
}
}
}
],
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 346,
"arcMinuteHeight": 216,
"canRotate": false,
"canResize": false
}
],
"mode": "HUB",
"shape": "RECTANGLE",
"pixelWidth": 1280,
"pixelHeight": 800,
"dpi": 213,
"currentPixelWidth": 1280,
"currentPixelHeight": 800,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Extensions": {
"available": {
"aplext:backstack:10": {}
}
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.bd7f1ea6-53ab-41af-9a59-4853d4906373"
},
"user": {
"userId": "amzn1.ask.account.AFMYVNKRB3REUKGDDLGIFOYXR53ISFLYHQJXHO2YDRYVQCPCRLYQFIVLBE5HDXH6FNMTMN4YLXHR6ZMSJEFQ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ypRihWklSFrj21KXBjwo0nO0mJyA-Q81jAJU-wjxLDLXm6btsD4z4NWtHYMkjiEcjXfPhE6MyFNEH1_jPU6HbnOl1xRQJkEtTZeb6C44ZmzUkfrKRgWetWqfOr2GnF11vpKGk2_ueoNJZcBoJhzr57DiQ"
}
},
"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.bf2b3b37-7260-4813-a43c-b94ae49b45bf",
"timestamp": "2021-07-19T16:40:08Z",
"locale": "en-US",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "An exception occurred while dispatching the request to the skill."
}
}
}
If you are hosting skill in lambda, there may be a chance for timeout. Database operations may take time, meanwhile lambda closed the session.
I think following log line suggests the same.
**2021-07-19T16:40:08.023Z 6a416b77-5d2c-4ebe-8ac4-dec09f67e9b9 Task timed out after 8.01 seconds**
Also, we have to consider maximum time allowed for Alexa to receive the response from end point. It is good to cap the response by 8 secs. For more information : DeferredResponse
When i'm trying to create the stack it throws the above error. I've checked and i'm using the correct property value.
I've tried adding a "DependsOn" for DHCPOptions. I've tried using the Fn:GetAtt for the DHCPOptions. None have proved successful.
"DHCPOptions": {
"Type": "AWS::EC2::DHCPOptions",
"Properties": {
"DomainName": { "Ref": "DNSName" },
"DomainNameServers": [ "AmazonProvidedDNS" ],
"Tags": [{
"Key": "Name",
"Value": {
"Fn::Sub": "${VPCStackName}-DHCPOPTS"
}
}]
}
},
"VPCDHCPOptionsAssociation": {
"Type": "AWS::EC2::VPCDHCPOptionsAssociation",
"DependsOn": "DHCPOptions",
"Properties": {
"VpcId": { "Ref": "TestVPC" },
"DHCPOptionsId": { "Ref": "DHCPOptions" }
}
},
Expecting to pass the DHCPOptionsId from the DHCPOptions.
I've found the issue. Just a simple error regarding the casing.
It should be DhcpOptionsId not DHCPOptionsId
Please help in accessing postgresql database view using strongloop.
im able to access table
{"name": "test",
"options": {
"idInjection": false,
"postgresql": {
"schema": "public",
"table": "test_data_v"
}
},
"properties": {
"assetid": {
"type": "String",
"required": false,
"length": 40,
"precision": null,
"scale": null,
"id": 1,
"postgresql": {
"columnName": "asset_id",
"dataType": "character varying",
"dataLength": 40,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
}
}}
in same way please suggest me how to access view
Thanks
Divya
I am not installed postgresql but I tried in mysql, Its working fine.
IN your model you can do directly see this Example
In database I have created view that is
CREATE VIEW shareviews AS
SELECT id,name
FROM share where id = 1;
In model you can call viewname directly like this example
module.exports = function(Share) {
var server = require('../../server/server');
var ds = server.dataSources.MySQL; // use server.dataSources.postgres;
Share.list = function(optionalparam, cb) {
var sql = 'select * from shareviews';
ds.connector.execute(sql, function(err, data)
{
if(err) return err;
console.log(err);
console.log("data",data);
cb(null, data);
});
}
Share.remoteMethod(
'list',
{
accepts: {arg: 'param', type: 'string'},
returns: {arg: 'result', type: 'object'},
http: {path: '/list', verb: 'get'}
}
);
};
You need to set data source in datasource.json
{
"db": {
"name": "db",
"connector": "memory"
},
"postgres": {
"host": "localhost",
"port": 5432,
"database": "postgres",
"username": "postgres",
"password": "*******",
"name": "postgres",
"connector": "postgresql"
}
}
Then in model-config.json you need to assign data source name to each
model.
That is
{
"_meta": {
"sources": [
"loopback/common/models",
"loopback/server/models",
"../common/models",
"./models"
],
"mixins": [
"loopback/common/mixins",
"loopback/server/mixins",
"../common/mixins",
"./mixins"
]
},
"User": {
"dataSource": "db"
},
"AccessToken": {
"dataSource": "db",
"public": false
},
"ACL": {
"dataSource": "db",
"public": false
},
"RoleMapping": {
"dataSource": "db",
"public": false
},
"Role": {
"dataSource": "db",
"public": false
},
"yourmodelname": {
"dataSource": "postgres",
"public": true
},
"yourmodelname": {
"dataSource": "postgres",
"public": true
}
}
then you can access database in you model.js or Rest call(example localhost:3000/explorer) For Example my
model name Grocerylist
module.exports = function(Grocerylist) {
Grocerylist.beforeRemote('create', function(context, user, next) {
var req = context.req;
req.body.date = Date.now();
req.body.shopperId = req.accessToken.userId;
next();
});
Grocerylist.complete = function(shopperId, cb) {
Grocerylist.find({
where: {
purchased:false,
shopperId: shopperId,
}
}, function(err, list) {
var response;
if (typeof list === 'undefined' || list.length === 0) {
response = "All done shopping!"
}
else {
response = "Shopping is not done.";
}
cb(null, response);
});
};
Grocerylist.remoteMethod(
'complete',
{
accepts: {
arg: 'shopperId', type: 'string'
},
http: {
path: '/complete',
verb: 'get'
},
returns: {
arg: 'complete',
type: 'string'
}
}
);
};
datasource.json:
"emailDs": {
"name": "emailDs",
"connector": "mail",
"transports": [{
"type": "smtp",
"host": "smtp.myapp.in",
"secure": true,
"secureConnection": true,
"port": 587,
"tls": {
"rejectUnauthorized": false
},
"auth": {
"user": "name#myapp.in",
"pass": "pwd"
}
}]
}
model-config.json
"Email": {
"dataSource": "emailDs"
}
mymodel.js (Extends default loopbacl's user model)
var options = {
type: 'email',
to: myUser.email,
from: 'name#myapp.in',
subject: 'Thanks for registering.',
template: path.resolve(__dirname, '../../server/views/verify.ejs'),
redirect: '/verified',
entrepreneur: entrepreneur
};
myUser.verify(options, function(err, response) {
if (err) {
next(err);
return;
}
When I am creating new user, this afterRemote 'create' code is running but while sending mail it is giving following error:
{
"error": {
"name": "Error",
"status": 500,
"message": "getaddrinfo EAI_AGAIN",
"code": "EAI_AGAIN",
"errno": "EAI_AGAIN",
"syscall": "getaddrinfo",
"hostname": "smtp.myapp.in",
"stack": "Error: getaddrinfo EAI_AGAIN\n at Object.exports._errnoException (util.js:746:11)\n at errnoException (dns.js:49:15)\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)"
}
}
I have created a new domain in Bigrock and using the free email service provided by them. Please suggest what am I doing wrong here.