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
267 stars 156 forks source link

Cannot use a remote json file to configure private data collection #2948

Closed FraPasqua closed 3 years ago

FraPasqua commented 3 years ago

Due to the new smart contract lifecycle interface, I can no longer use a remote file as a private data collection configuration json file.

Description

Hello, due to covid we have been using remote machines (still in our office) as dev workstations, and as such, every runtime (including hyperledger networks) are run on them. This means, even the vscode server instance, and all the installed extensions, including this one. We just open vscode and remote connect to our machines (via the remote ssh extension), in order to code and test our stuff.

Since the 2.0 update, I can no longer use a private data config json file that is hosted on one of these remote workstations to configure a smart contract under deployment. Whenever I click on the new icon, that just brings up a windows (my host terminal here at home) file chooser, and tells me to pick a file on my home file system, instead on the remote one, where it is.

I have already tried downloading the json file on my home terminal machine, and picking it with the file chooser interface that comes up, and everything seems to go through until an error pops up during deployment, complaining that it could not find the file at that given path. Because that given path is a windows file system path, and the remote machine tries to look it up through there, even if it is a linux server.

So I have no way of provisioning a private data collection configuration file at the present moment.

Expected Behavior

That the file chooser would pick a file on my home system, and actually upload it to the remote machine. Or just allow me to use a file that's on the remote file system as it was before.

Actual Behavior

The extension requires me to provide a file that's on my home terminal, by using a windows file chooser. But then tries to read the file on the remote file system, failing because the file path specified by me in the file chooser, obviously, does not exist on the remote machine.

Possible Fix

Just allow me to specify exactly where the file is on the remote machine like it was before, provide the entire json by copy pasting, or allow the extension to upload the file from my home machine to the remote one.

Steps to Reproduce

1.Have a remote machine on which install the remote ssh extension and the IBM blockchain vscode extension 2.Create a local blockchain network instance on the remote machine 3.Try to deploy a new smart contract from the home machine, and try to specify a private data collection json file 3.1 Even if the file is present on your home machine, the remote one won't be able to use it at deployment time, and an error will be raised.

Log File

(note, this is the blockchain extension output I pasted here, if I try to open the logs file as the first line suggests, it just opens my windows (so, local, on the home computer) logs folder, where there is no IBM blockchain extension log, and it is present on the remote side)

[2021-2-2 9:48:42] [IMPORTANT] Log files can be found by running the Developer: Open Logs Folder command from the palette

[2021-2-2 9:48:42] [INFO] Starting IBM Blockchain Platform Extension [2021-2-2 9:48:42] [INFO] Clearing extension cache [2021-2-2 9:48:42] [INFO] Restoring command registry [2021-2-2 9:48:43] [INFO] Registering commands [2021-2-2 9:48:43] [INFO] Execute stored commands in the registry [2021-2-2 9:48:43] [INFO] IBM Blockchain Platform Extension activated [2021-2-2 9:53:31] [INFO] connecting to fabric environment [2021-2-2 9:53:32] [SUCCESS] Connected to Catch2OrgNet2 [2021-2-2 9:56:31] [ERROR] Error: ENOENT: no such file or directory, open 'C:\Users\Profw.LAP-FPASQUA\Desktop\privateDataDefinition.json' [2021-2-2 9:57:11] [ERROR] Error: ENOENT: no such file or directory, open 'C:\Users\Profw.LAP-FPASQUA\Desktop\privateDataDefinition.json'

Your Environment

The windows file chooser appears, and then I pick the privateData.json file on my home filesystem. immagine

The extension accepts the file without any complaint (for now). immagine

As soon as I hit next, this appears (bottom right corner) immagine

If I then try to hit deploy anyway, the error is repeated and nothing happens.

james-wallis commented 3 years ago

Thanks for raising @FraPasqua. In V2 we introduced the Deploy view which is a webview. The webview is essentially a browser, so I think that is why it's showing your desktop files as opposed to your remote ones - think this is the issue.

I'm currently working on a change in https://github.com/IBM-Blockchain/blockchain-vscode-extension/pull/2989 which should allow you to have the config file on your local machine.

james-wallis commented 3 years ago

I've raised PR #2993 to resolve this issue.

@FraPasqua would you be able to test the fix on your system? I don't have an environment available to test the fix. It'll also mean that you can work off that VSIX until we can do a new release.

The built VSIX is available on Azure, under vscode-package - click the three dots on the right to download it.

FraPasqua commented 3 years ago

Hello, thanks for your support. I installed the VSIX build, and I can confirm I can now go ahead with the installation and then instantiation of my chaincode, by picking a private data definition json file on my remote machine.

Still, after starting the installation process, these two errors appeared immagine

Is this unrelated or there's something I should be doing? I can cofirm I was able to install and instantiate this same code without problems before (just with no private data definition file).

james-wallis commented 3 years ago

Thanks for testing! Appreciate it.

I think it's unrelated but I will do some testing to be sure.

james-wallis commented 3 years ago

@FraPasqua I've tested this using a Private contract on a two org network with no issues. Not tested the remote environment but as per your comment above I think that works also.

I've added a comment to the PR to show what I've tested https://github.com/IBM-Blockchain/blockchain-vscode-extension/pull/2993#issuecomment-802865170

Regarding the REQUEST_TIMEOUT error that you've seen it occurs when the client timeouts before the action is finished. You could try bumping up the VSCode setting to something like "ibm-blockchain-platform.fabric.client.timeout": 300 by using the VSCode command Preferences: Open Settings (JSON).

However, it could be something isn't working correctly and it'll never work regardless of the timeout value - but worth trying it first.

FraPasqua commented 3 years ago

I can confirm, the problem was unrelated and on my end.

Everything is working as intended now, thank you James.

james-wallis commented 3 years ago

Cheers @FraPasqua, that PR has merged so look out for it in a future release! #2993