IBM-Blockchain / blockchain-vscode-extension

IBM Blockchain Platform extension for Visual Studio Code (this project is no longer active)
https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform
Other
266 stars 156 forks source link

Error when instantiating contract #962

Closed Moni-Haimovich closed 5 years ago

Moni-Haimovich commented 5 years ago

This issue started after the last VSC blockchain extension update. When trying to instantiate a contract on my local fabric ops I'm getting the following error:

[5/13/2019 11:41:53 AM] [INFO] Starting IBM Blockchain Platform Extension [5/13/2019 11:41:53 AM] [INFO] Migrating local runtime manager [5/13/2019 11:41:53 AM] [INFO] Initializing local runtime manager [5/13/2019 11:41:54 AM] [INFO] Registering commands [5/13/2019 11:41:54 AM] [INFO] IBM Blockchain Platform Extension activated [5/13/2019 11:42:03 AM] [INFO] instantiateSmartContract [5/13/2019 11:42:39 AM] [ERROR] Error instantiating smart contract: Error: error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "

@ampretia/x509@0.4.0 install /chaincode/output/node_modules/@ampretia/x509 node-gyp rebuild

gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: 403 response downloading https://nodejs.org/download/release/v8.11.3/node-v8.11.3-headers.tar.gz gyp ERR! stack at Request. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:210:14) gyp ERR! stack at emitOne (events.js:121:20) gyp ERR! stack at Request.emit (events.js:211:7) gyp ERR! stack at Request.onRequestResponse (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1068:10) gyp ERR! stack at emitOne (events.js:116:13) gyp ERR! stack at ClientRequest.emit (events.js:211:7) gyp ERR! stack at HTTPParser.parserOnIncomingClient (_http_client.js:543:21) gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:112:17) gyp ERR! stack at TLSSocket.socketOnData (_http_client.js:440:20) gyp ERR! stack at emitOne (events.js:116:13) gyp ERR! System Linux 4.15.0-47-generic gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /chaincode/output/node_modules/@ampretia/x509 gyp ERR! node -v v8.11.3 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm WARN invioupapercontract@1.0.4 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ampretia/x509@0.4.0 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ampretia/x509@0.4.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-05-13T08_42_38_254Z-debug.log "

davidkel commented 5 years ago

@Moni-Haimovich The error is saying that the chaincode builder container is unable to contact and download this resource https://nodejs.org/download/release/v8.11.3/node-v8.11.3-headers.tar.gz It could be due to networking issues or the nodejs.org server being down temporarily. It could also be a problem with docker itself. If you are running on windows or mac then docker runs a hidden linux VM to run the containers and it could be an issue with that VM

Moni-Haimovich commented 5 years ago

@davidkel Thank you for your quick response. I don't know why it's looking for v8.11.3 (which is not available any more).I'm using v10.15. Any thoughts why it's looking for this old version?

davidkel commented 5 years ago

@Moni-Haimovich Fabric 1.4.1 runs node.js chaincode using v8.11.3, and those headers are still available to download.

Moni-Haimovich commented 5 years ago

@davidkel I'm able to access and download the 8.11.3 headers manually - so I guess it's not a network problem or nodejs.org server issue. I'm running on ubuntu - so I'm not sure it's a docker issue. The strange thing is that everything worked fine until yesterday. Any idea?

davidkel commented 5 years ago

@Moni-Haimovich It could still be a docker problem.

  1. first spin up a chaincode image builder container docker run -it hyperledger/fabric-ccenv /bin/bash you will get a prompt such as root@0485d39cae54:/#
  2. on that prompt try the following commands node -v (should be v8.11.3) curl -O https://nodejs.org/download/release/v8.11.3/node-v8.11.3-headers.tar.gz tar -xvf node-v8.11.3-headers.tar.gz if the tar outputs a load of files then it worked. If it fails then cat node-v8.11.3-headers.tar.gz To look at the output from the curl file.
Moni-Haimovich commented 5 years ago

@davidkel root@67045e0c36df:/# tar -xvf https://nodejs.org/download/release/v8.11.3/node-v8.11.3-headers.tar.gz tar: Cannot connect to https: resolve failed root@67045e0c36df:/# cat node-v8.11.3-headers.tar.gz <!DOCTYPE html>

Attention Required! | Cloudflare

One more step

Please complete the security check to access nodejs.org

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this in the future?

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.

davidkel commented 5 years ago

@Moni-Haimovich Sorry I got the tar command slightly wrong, I have corrected it however there is no need for you to run it. It looks like when your container tries to access the node.js website it's being blocked with a request for you to complete a CAPTCHA. Not sure who is generating that request though, might be something to do with the network you are on.

Moni-Haimovich commented 5 years ago

@davidkel root@67045e0c36df:/# tar -xvf https://nodejs.org/download/release/v8.11.3/node-v8.11.3-headers.tar.gz tar: Cannot connect to https: resolve failed root@67045e0c36df:/# cat node-v8.11.3-headers.tar.gz <!DOCTYPE html>

Attention Required! | Cloudflare

One more step

Please complete the security check to access nodejs.org

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this in the future?

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.

Moni-Haimovich commented 5 years ago

Thank you it was a network issue