Ionic - E/Capacitor: Unable to open asset URL - ionic-framework

I can't load any image from external url in real device. I am always getting the following error:
This is my capacitor.config.json
{
...,
server: {
cleartext: true,
hostname: "rootsmenu.com",
allowNavigation: [
'localhost',
'rootsmenu.com'
]
}
}

I edited capacitor.config.ts with following configs and it worked! Also, I was editig the wrong file android/app/src/main/assets/capacitor.config.json. Because it was replaced with capacitor.config.ts content each time I ran npx cap sync android
capacitor.config.ts
{
...
"android": {
"allowMixedContent": true
},
"server": {
"cleartext": true,
"hostname": "localhost"
}
}

Related

"before each" hook: codeceptjs error message

im using codeceptjs using protractor helper, and i tried to wtite simple code
and to run this command"npm run codeceptjs"
and i faced this error "× "before each" hook: codeceptjs.before for "test something" in 285ms"
here is my code on this file "test_test.js"
Feature('My First Test');
Scenario('test something', ({ I }) => {
I.amOnPage('/');
I.see('GitHub');
});
here package.json
{
"name": "codeceptjs-tests",
"version": "0.1.0",
"private": true,
"scripts": {
"codeceptjs": "codeceptjs run --steps",
"codeceptjs:headless": "HEADLESS=true codeceptjs run --steps",
"codeceptjs:ui": "codecept-ui --app",
"codeceptjs:demo": "codeceptjs run --steps -c node_modules/#codeceptjs/examples",
"codeceptjs:demo:headless": "HEADLESS=true codeceptjs run --steps -c
node_modules/#codeceptjs/examples",
"codeceptjs:demo:ui": "codecept-ui --app -c node_modules/#codeceptjs/examples"
},
"devDependencies": {
"#codeceptjs/configure": "^0.8.0",
"#codeceptjs/examples": "^1.2.1",
"#codeceptjs/ui": "^0.4.6",
"codeceptjs": "^3.0.0",
"playwright": "^1.19.2",
"protractor": "^5.3.0"
}
}
here codecept.conf.js file
const { setHeadlessWhen } = require('#codeceptjs/configure');
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);
exports.config = {
tests: './*_test.js',
output: './output',
helpers: {
Protractor: {
url: 'http://www.github.com',
driver: 'hosted',
browser: 'chrome',
rootElement: 'body',
angular: false
}
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'Task1',
plugins: {
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
}
how could i fix the issue?
Error seems to be related to the selenium server. You can see details on https://github.com/codeceptjs/CodeceptJS/issues/2634
Please follow the steps on codecept website for project setup
https://codecept.io/angular/#setting-up-codeceptjs-with-protractor

Failed to submit transaction: Error: no suitable peers available to initialize from

I am running my blockchain project which is election system using blockchain using hyperledger fabric and IBM blockchain Platform VSCode Extension (runnning my network locally). I am successfull to run connect to local fabric and my gateway is running successfully(image attached). Also all docker containers of peer,orderer,certificate authority are running (image attached).
connected to local fabric and gateway
all docker containers running successfuly
The problem which I am facing is that when (after connecting to local fabric and gateway) I am running invoke.js file using the command "node invoke.js" I am encountering above error. following picture link shows how I am running invoke.js
trying to run invoke.js but facing error
following is my config.json file code
{
"connection_file": "fabric_connection.json",
"appAdmin": "admin",
"appAdminSecret": "adminpw",
"orgMSPID": "org1MSP",
"caName": "ca",
"userName": "V1",
"gatewayDiscovery": { "enabled": true, "asLocalhost": true }
}
and following is my fabric-connection.json file code
{
"certificateAuthorities": {
"ca.org1.example.com": {
"caName": "ca",
"url": "http://localhost:17090"
}
},
"client": {
"connection": {
"timeout": {
"orderer": "300",
"peer": {
"endorser": "300"
}
}
},
"organization": "Org1MSP"
},
"name": "ca.org1.example.com",
"organizations": {
"Org1MSP": {
"certificateAuthorities": [
"ca.org1.example.com"
],
"mspid": "Org1MSP",
"peers": [
"Org1Peer1"
]
}
},
"peers": {
"Org1Peer1": {
"url": "grpc://localhost:17091"
}
},
"version": "1.0.0"
}
and following is my invoke.js file complete code
//Import Hyperledger Fabric 1.4 programming model - fabric-network
'use strict';
const { FileSystemWallet, Gateway } = require('fabric-network');
const path = require('path');
const fs = require('fs');
//connect to the config file
const configPath = path.join(process.cwd(), './config.json');
const configJSON = fs.readFileSync(configPath, 'utf8');
const config = JSON.parse(configJSON);
// connect to the connection file
const ccpPath = path.join(process.cwd(), './ibpConnection.json');
const ccpJSON = fs.readFileSync(ccpPath, 'utf8');
const connectionProfile = JSON.parse(ccpJSON);
// A wallet stores a collection of identities for use
const walletPath = path.join(process.cwd(), './wallet');
const wallet = new FileSystemWallet(walletPath);
console.log(`Wallet path: ${walletPath}`);
const peerIdentity = 'admin';
async function queryAll() {
try {
let response;
// Check to see if we've already enrolled the user.
const userExists = await wallet.exists(peerIdentity);
if (!userExists) {
console.log('An identity for the user ' + peerIdentity + ' does not exist in the wallet');
console.log('Run the registerUser.js application before retrying');
response.error = 'An identity for the user ' + peerIdentity + ' does not exist in the wallet. Register ' + peerIdentity + ' first';
return response;
}
//connect to Fabric Network, but starting a new gateway
const gateway = new Gateway();
//use our config file, our peerIdentity, and our discovery options to connect to Fabric network.
await gateway.connect(connectionProfile, { wallet, identity: peerIdentity, discovery: config.gatewayDiscovery });
//connect to our channel that has been created on IBM Blockchain Platform
const network = await gateway.getNetwork('mychannel');
//connect to our insurance contract that has been installed / instantiated on IBM Blockchain Platform
const contract = await network.getContract('voteChainDemo');
//submit transaction to the smart contract that is installed / instnatiated on the peers
console.log('calling contract.evaluateTransaction, with args');
response = await contract.submitTransaction('queryAll');
response = JSON.parse(response.toString());
console.log(`response from evaluateTransaction: ${(response)}`)
console.log('Transaction has been submitted');
// Disconnect from the gateway.
await gateway.disconnect();
} catch (error) {
console.error(`Failed to submit transaction: ${error}`);
}
}
// let args = ["V1"]
// args = args.toString();
queryAll();
and I see following logs when I view docker container logs of peer0.org1.example.com
enter image description here
following is the code of ibpconnection.json file
{
"name": "mychannel",
"description": "Network on IBP v2",
"version": "1.0.0",
"client": {
"organization": "org1MSP"
},
"organizations": {
"org1MSP": {
"mspid": "org1MSP",
"peers": [
"173.193.112.109:17091"
],
"certificateAuthorities": [
"173.193.112.109:7054"
]
}
},
"orderers": {
"173.193.112.109:7050": {
"url": "grpcs://173.193.112.109:17097",
"tlsCACerts": {
"pem": "-----BEGIN CERTIFICATE-----\nMIICJzCCAc6gAwIBAgIUCZxOyrvnwM/IG/3zQ9opnOE/gBEwCgYIKoZIzj0EAwIw\nZTELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK\nEwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRYwFAYDVQQDEw1PcmRlcmVy\nQ0EtdGxzMB4XDTE5MDYxNDIwNDcwMFoXDTM0MDYxMDIwNDcwMFowZTELMAkGA1UE\nBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBlcmxl\nZGdlcjEPMA0GA1UECxMGRmFicmljMRYwFAYDVQQDEw1PcmRlcmVyQ0EtdGxzMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEOXI7XkoPBn7a9Q1x2S8SpmilQBalhorq\nCo96GChxQU0HJX/1qRPNN72CKx2YS/ksl+eOaHe/+pH32S5VWZLxaKNcMFowDgYD\nVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYEFIdV28CJ\nPozrl6hpxVkKpNdmAO7vMBUGA1UdEQQOMAyHBK3BcG2HBApM2GAwCgYIKoZIzj0E\nAwIDRwAwRAIgTOPmbGXzIL8SriNT/x8XdBLoTbpEVd/HIpv9nf0bWysCIBvOppOp\nvINgCydCwV1FTbP5tuqYxuShVTAba1h9ZZmm\n-----END CERTIFICATE-----\n"
}
}
},
"peers": {
"173.193.112.109:17091": {
"url": "grpcs://173.193.112.109:17093",
"tlsCACerts": {
"pem": "-----BEGIN CERTIFICATE-----\nMIICIzCCAcqgAwIBAgIUbY5U1xnvvSqJ61CgeMp9/qu448owCgYIKoZIzj0EAwIw\nYzELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK\nEwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRQwEgYDVQQDEwtWb3RlckNB\nLXRsczAeFw0xOTA2MTQyMDQwMDBaFw0zNDA2MTAyMDQwMDBaMGMxCzAJBgNVBAYT\nAlVTMRcwFQYDVQQIEw5Ob3J0aCBDYXJvbGluYTEUMBIGA1UEChMLSHlwZXJsZWRn\nZXIxDzANBgNVBAsTBkZhYnJpYzEUMBIGA1UEAxMLVm90ZXJDQS10bHMwWTATBgcq\nhkjOPQIBBggqhkjOPQMBBwNCAASFv8sUAUfTvn8AJ/fiqrk0wdoMaKlG38nU6HZB\nkdUgFWZH9vnlTTBT77+GYRXuv78lg7ttus6DEAJE0X1xDd27o1wwWjAOBgNVHQ8B\nAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAdBgNVHQ4EFgQUHuwEDf9d4vrv\nZM+qveoS9PV8/5cwFQYDVR0RBA4wDIcErcFwbYcECkzYYDAKBggqhkjOPQQDAgNH\nADBEAiBjynyKK+Bo4WX3wQII1nk2BU8OaYAuBvpTS/pPROdX+QIgSsLzKWuR7dFN\n50KrbM4ayRuaFBOFL88FflKxaRjQels=\n-----END CERTIFICATE-----\n"
},
"grpcOptions": {
"ssl-target-name-override": "173.193.112.109"
}
}
},
"certificateAuthorities": {
"173.193.112.109:7054": {
"url": "https://173.193.112.109:17090",
"caName": "ca",
"tlsCACerts": {
"pem": "-----BEGIN CERTIFICATE-----\r\nMIICezCCAeSgAwIBAgIJNQli68LG70HNMA0GCSqGSIb3DQEBBQUAMHUxGDAWBgNV\r\nBAMTDzE3My4xOTMuMTEyLjEwOTELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRo\r\nIENhcm9saW5hMRAwDgYDVQQHEwdSYWxlaWdoMQwwCgYDVQQKEwNJQk0xEzARBgNV\r\nBAsTCkJsb2NrY2hhaW4wHhcNMTkwNjE0MjA0NDM2WhcNMjAwNjEzMjA0NDM2WjB1\r\nMRgwFgYDVQQDEw8xNzMuMTkzLjExMi4xMDkxCzAJBgNVBAYTAlVTMRcwFQYDVQQI\r\nEw5Ob3J0aCBDYXJvbGluYTEQMA4GA1UEBxMHUmFsZWlnaDEMMAoGA1UEChMDSUJN\r\nMRMwEQYDVQQLEwpCbG9ja2NoYWluMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\r\ngQCXKBfHLyQfavboQU0y/3S4jlqh6vQgXZKeAMliXfigf6aLG/3Oc4pxuQxBccB6\r\nAiYTFZdShTy2Usx5GsDf5PWxfD4vJ8FWzAGlIYmVqseKXXjsQvwMlCMyS9K2NaDo\r\n9tXwvHz8Sgncq7KccseVYwX4FFpSQWZsIV27Y2xkMZ9bVQIDAQABoxMwETAPBgNV\r\nHREECDAGhwStwXBtMA0GCSqGSIb3DQEBBQUAA4GBAG1+VZNSQdm0DX9CbZzx9zbx\r\nnTEHyrhVTgZs5YuUvZX8BErYfJFxuPBsXhOpQan/L9y+a7C/Caac4WJ/l/l34e5M\r\nG1Hn603wkHpR0UFuGCikdctm+6iHUVro5CMfQlEPIqaJSTFb7Ju5aeeerHnkvQx8\r\nBShP1pNsvsyOctmFhQCQ\r\n-----END CERTIFICATE-----\r\n"
}
}
}
}
In my project which is pretty much having the same things as you, I did not specified the orderers in my connection config file. I am not sure if it is required in your scenario.
Besides, I think the issue is caused by incorrect urls specified in your ibpconnection.jsonfile.
orderers should have "url": "grpcs://173.193.112.109:7050"
AND
peers should have "url": "grpcs://173.193.112.109:17091"
Hope this will fix the error. Good luck!!!!

why does hashicorp vault json config fail with "Error initializing listener of type listener"?

When using hashicorp vault version 1.0.2 and the following JSON configuration file in config.json:
{
"listener": [
{
"tcp": [
{
"address": "0.0.0.0:8300",
"tls_disable": 1
}
]
}
],
"storage": {
"file": {
"path": "/tmp/foobar"
}
}
}
vault server -config config.json fails with Error initializing listener of type listener: unknown listener type: "listener".
However, with the same configuration in config.hcl
listener tcp {
address = "0.0.0.0:8300"
tls_disable = 1
}
storage file {
path = "/tmp/foobar"
}
vault server -config config.hcl works as expected:
==> Vault server configuration:
Cgo: disabled
Listener 1: tcp (addr: "0.0.0.0:8300", cluster address: "0.0.0.0:8301", max_request_duration: "1m30s", max_request_size: "33554432", tls: "disabled")
Log Level: (not set)
Mlock: supported: true, enabled: true
Storage: file
Version: Vault v1.0.2
Version Sha: 37a1dc9c477c1c68c022d2084550f25bf20cac33
==> Vault server started! Log data will stream in below:
...
What am I missing?
The JSON seems to be correct, try removing the square brakets:
{
"listener":
{
"tcp":
{
"address": "0.0.0.0:8300",
"tls_disable": 1
}
},
"storage": {
"file": {
"path": "/tmp/foobar"
}
}
}

Couchbase Sync Gateway doesn't sync between Couchbase Lite and Couchbase Server

i have a very big problem. I'm building an app at the moment. When I start the App with the Android emulator it works fine. I can save some Data and it will show me these too. So it saves the Data locally. (Couchbase Lite)
I work with an ionic framework.
Now I want to sync between Couchbase Server and Couchbase Lite.
I use the Sync Gateway, but it doesn't work.
Below you can see my sync-gateway-config.json and my log.
Can someone help me please?
{
"interface": ":4984",
"adminInterface": "0.0.0.0:4985",
"log": ["*"],
"databases": {
"syncdb": {
"server": "http://127.0.0.1:8091",
"bucket": "sync_gateway",
"username": "sync_gateway",
"password": "********",
"sync":
function (doc) {
channel (doc.channels);
},
"users": {
"GUEST": {
"disabled": true,
"admin_channels": ["public"]
},
"Administrator": {
"disabled": false,
"password": "**********",
"admin_channels": ["*"]
}
}
}
Log
The Android emulator uses a special address to connect to the machine it runs on. Set your app to connect to Sync Gateway via 10.0.2.2. See this Stack Overflow post for more information.
you can add the property: "import_docs": "continuous", and "enable_shared_bucket_access": true, in your database config, between syncdb braces, to see if there is a differencee.
"syncdb": {
"import_docs": "continuous",
"enable_shared_bucket_access": true,
"server": "http://127.0.0.1:8091",
........
}

How to interact with Windows Authentication and Users group using React.js .Net

I am curious how one would interact with Windows Authentication using React.js.
We have a little internal portal we are trying to set up, we already have predefined users groups and users that are in them. We are looking for a way to get those Authenticated credentials to the view using React.js. There are a couple of good links on how to get started with Reactjs.net but I don't see any tutorials on passing credentials to Reactjs.
Any suggested reading? Tutorials or maybe you know yourself and can provide direction?
enter link description here
I've found this really cool tutorial!
It says:
Here’s a minimal setup for React and Webpack based on what we did in this article. Now that you understand the steps, you can copy-paste this to your heart’s content.
package.json
Note: agentkeepalive is only needed for fixing a Windows authentication error with Hot Module Replacement.
{
"name": "ReactWebPackMVC5",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack",
"dev": "webpack-dev-server –open –hot"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/core": "^7.0.0",
"#babel/preset-env": "^7.0.0",
"#babel/preset-react": "^7.0.0",
"agentkeepalive": "^3.5.1",
"babel-loader": "^8.0.2",
"react": "^16.5.0",
"react-dom": "^16.5.0",
"webpack": "^4.18.0",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.8"
}
}
webpack.config.js
Again, agentkeepalive is only needed for fixing a Windows authentication error with Hot Module Replacement. The same is true for the agent and onProxyRes properties.
const path = require("path"); const agent = require("agentkeepalive")
module.exports = { mode: "development", entry: "./Scripts/react/app.js", //or app.jsx output: { path: path.resolve(__dirname, "./Scripts/react/dist"), filename: "bundle.js", publicPath: "Scripts/react/dist" }, resolve: { extensions: ["*", ".js", ".jsx"] }, module: { rules: [ { test: /\.(js|jsx)/, exclude: /node_modules/, use: { loader: "babel-loader", options: { “presets”: [“#babel/preset-env”, “#babel/preset-react”] } } } ] }, devServer: { proxy: { "*": { target: "http://localhost:59829", changeOrigin: true, agent: new agent({ maxSockets: 100, keepAlive: true, maxFreeSockets: 10, keepAliveMsecs: 100000, timeout: 6000000, keepAliveTimeout: 90000 // free socket keepalive for 90 seconds }), onProxyRes: (proxyRes) => { var key = "www-authenticate"; proxyRes.headers[key] = proxyRes.headers[key] && proxyRes.headers[key].split(","); }, }, port: 8080, host: "0.0.0.0", hot: true, }, } };

Categories