Firefox Throws Error When Installing Fabric Chaincode - hyperledger-fabric

I am currently developing a tool which takes required configuration information from the user via a GUI and creates a local fabric test network according to the given information. The backend and GUI both run in the localhost. The app also has features like installing, approving and committing chaincodes, joining channels, creating ca or peer nodes. The tech stack is as follows;
GUI: Vue.js 3
Backend: Node 14 LTS
Fabric: 2.3.1
Ubuntu: 20.04
My problem is when I am installing a chaincode to a peer Firefox throws the following error;
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5000/prepareCommit. (Reason: CORS request did not succeed).
The strange thing is that I handle cors issues in my backend (using cors packege with express.js) and only when the code hits where I call peer lifecycle chaincode install firefox throws this error. But when I disable the line where I call install command or I run another command like peer channel list Firefox does not throw any error. Also this error does not happen when I test with Chrome or Postman.
My Firefox version: 92.0(64-bit) for Ubuntu canonical - 1.0
Full Error Messages:
Browser: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5000/prepareCommit. (Reason: CORS request did not succeed).
Client Code: Type-Error: Network Error when attempting to fetch resources
The MDN docs say that it is possible addons, adblockers or extensions might be causing this since the error message indicates the error happened either network or protocol level. So here are the things I have tried;
Run firefox in the troubleshoot mode (Still threw the error)
Test using CHROME and POSTMAN (No error occurred)
Run different code other than peer lifecycle chaincode install such as peer channel list (No error)
Make the code wait 120 seconds in order to eliminate timeout related issues (No error)
I don't come across this issue when running other peer commands. So my belief is that peer lifecycle chaincode install command somehow breaks the connection between firefox and my server. Is there anyone who has any idea what the cause of this error might be? Any help would be appreciated. Thanks in advance

Related

Pytorch Install

I HAVE A ERROR IN INSTALLING PYTORCH:
PLEASE HELP ME.
CondaHTTPError: HTT P000 CONNECTION FAILED for url https://conda.anaconda.org/pytorch/win-64/current_repodata.json
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https//conda.anaconda.org/pytorch/win-64'
An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way
The possible reason for HTTP error could be an unstable network connection or a corporate firewall.
If it was an unstable network connection, as mentioned in the Error message, retry the installation steps that failed.
If you are behind a corporate firewall, you might need additional steps to add your proxy server to the .condarc file on your machine.
Since you are on Windows, you could open the Anaconda prompt and run conda info to figure out where the .condarc file is located.
Find the proxy by running echo "$http_proxy" in your prompt. Copy the proxy.
Open the .condarc file and paste the proxy under proxy_servers section
For more details see: Anaconda Docs: Configure conda for use behind a proxy server (proxy_servers)

HyperLedger Fabric First Network Setup Issues

I'm newbie in the HyperLedger Fiber Technology and I'm following this official tutorial to build my first network. I replaced example.com with the domain of my company. After generating certificates I ran the follow command to up my network:
./byfn.sh up -c ttchannel
I get the following error during channel creation:
Error: got unexpected status: FORBIDDEN -- Failed to reach implicit threshold of 1 sub-policies, required 1 remaining: permission denied
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
Then I verified from PEERs containers that peers are already connected with this channel (don't know why and when this connection got established), So, I restarted this network and then got the following error:
Error: failed to create deliver client: failed to load config for OrdererClient: unable to load orderer.tls.rootcert.file: open /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/vodworks.com/orderers/orderer.vodworks.com/msp/tlscacerts/tlsca.vodworks.com-cert.pem: no such file or directory
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
And then I verified in the CLI container that crypto directory wasn't accessible so I have to restart that container to make it accessible. but still I was unable to run it.
Can anyone please suggest that what these error means and how can I run my network?
Where exactly did you change "example.com"? I'm pretty sure the setup script also creates all the crypto material based on configtx.yaml file, that has "example.com" as domain everywhere. The docker-compose files then map the created folders as volume into the container (see docker-compose-base.yml):
../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
So the docker-compose file also expects the certs to be in this folders. From your description I would expect that you missed to change the domain at some point.
The Reason of this error was that network was not going down properly. All the peers were connected with the channel already as I verified by running the command peer channel list inside the container of each peer which was resulting in the following output:
Channels peers has joined:
ttchannel
And with this situation, the command peer channel create ... was actually throwing this error. So, I'm able to run the network successfully with the following command:
**./byfn.sh restart -c ttchannel -s couchdb -t 60 -d 10**
Which actually first put the network down and then start it again.

why am I receiving error starting microclimate on macos stating TLS handshake timeout

I've successfully completed the ./install.sh command. When I run the next "~/mcdev start -o" I receive this error: "Starting Microclimate
Pulling microclimate-file-watcher (ibmcom/microclimate-file-watcher:1809)...
ERROR: Get https://registry-1.docker.io/v2/ibmcom/microclimate-file-watcher/manifests/1809: net/http: TLS handshake timeout
Error starting Microclimate"
I have running on my pc:
git version 2.17.1 (Apple Git-112); Docker version 18.06.1-ce; MacOS
High Sierra v 10.13.6; latest Microclimate v18.09
My network is up and I don't have any proxy.
What am I missing or doing wrong?
I got this to work by changing to a different wifi \ internet connection. Still not sure why my home wifi, with no restrictions that I'm aware of, will 'block' the dependency downloads upon start of Microclimate.
If anybody has additional info to help find the root cause please feel free to share.
This docker error generally shows up when your internet connection is too slow for Docker, as it times out performing the TLS handshake. This would also explain why moving to another network fixes the issue.

Composer update does not run

When i run composer update it fails showing error:
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream:
Connection refused
If i visit the URL from my browser it goes through, when i try to wget or curl the URL from my terminal it shows error:
--2017-02-05 20:41:58-- https://packagist.org/packages.json
Connecting to 127.0.0.1:8888... failed:
Connection refused.
--2017-02-05 20:41:58-- https://packagist.org/packages.json
Connecting to 127.0.0.1:8888... failed: Connection refused.
I think its something with proxy connection, but then i can't seem to solve the issue.
Bellow is the full trace if i run composer update -vv:
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/gidiscrap): git branch --no-color --no- abbrev -v
Cannot create cache directory /home/oluwaslim/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/oluwaslim/.composer/cache/files/, or directory is not writable. Proceeding without cache
Failed to initialize global composer: Composer could not find the config file: /home/oluwaslim/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /var/www/gidiscrap/vendor/composer/installed.json
Running 1.3.2 (2017-01-27 18:23:41) with PHP 7.0.13-0ubuntu0.16.04.1 on Linux / 4.4.0-59-generic
Loading composer repositories with package information
Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888
Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888
Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection refused
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:489
Composer\Util\RemoteFilesystem->get() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:101
Composer\Util\RemoteFilesystem->getContents() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:665
Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:479
Composer\Repository\ComposerRepository->loadRootServerFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:258
Composer\Repository\ComposerRepository->hasProviders() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:99
Composer\DependencyResolver\Pool->addRepository() at phar:///usr/local/bin/composer/src/Composer/Installer.php:376
Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:223
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:158
Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:850
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:227
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:124
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:100
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:54
require() at /usr/local/bin/composer:24
Help would be appriciated! I can't seem to get past this error
Am on Ubuntu Linux 16.04, and below is what i had to do to fix the issue, as i mentiond earlier its some problem with proxy settings.
Step 1
Goto System settings
Network
Network proxy
Change it to none
finally click Apply system wide
Step 2
Open terminal and type the following command.
unset https_proxy && unset socks_proxy && unset ftp_proxy
Finally restart your system. The solution above got the issue solved for me.
The line using proxy 127.0.0.1:8888 suggest a problem with your system. I can guess that's a really aggressive antivirus. You should have no reason to connect to localhost on port 8888 unless you have to connect through proxy. What can you do? Check the antivirus settings and turn off checks for secure connections over HTTPS.

Node.JS code fails without error on Ubuntu

I have the simplest code for firebase :
var Firebase=require('firebase');
var Ref=new Firebase('http://mydb.firebaseio.com/requests');
Ref.push({name:"checkin",type:"mandatory"},function(response){
console.log(response);
});
and I'm running it with SSH in command line on my Ubuntu 12.04 server. For some reason the push method runs but doesn't push anything and doesn't even show an error. I tried logging the error to a file but the file remains empty. I also tried catching an uncaught exception from the process, no luck. There basically isn't an error to show. How should I catch an error so I can investigate further ?
Extra information :
-Node.JS version installed on the server is 12.4 .
-One thing I noticed is there is no certificate file on the server and for example I can't use curl with an https url or PPA to download a package.
-Ubuntu 12.04.
-When I push to firebase using a PHP script it works fine but nodeJS fails to do it.
-The server is in a hospital's internal network and connects to internet through a proxy. Certain HTTPS websites are allowed on port 80 , the rest are blocked . Some similar policies might be in place for other ports and protocols.

Resources