spydra-tech / fabric-debugger

Extension for Visual Studio Code that makes it easy for developers to build and debug Chaincode right from within the IDE.
Apache License 2.0
14 stars 3 forks source link

[BUG]: Arguments to chaincode has text of a function appended to it and fails with error about a '\n' in args #266

Open Nova38 opened 6 months ago

Nova38 commented 6 months ago

Describe the bug For some reason the extention is appending a function onto the end of the list of my arguments when calling a chaincode.

To Reproduce Steps to reproduce the behavior: I tried my own .fabric files and just copying the example and they both caused the issue with it claimg there was a '\n' in the argument

[
    {
        "query": "ReadAsset",
        "args": ["asset1"]
    }
]

Expected behavior A clear and concise description of what you expected to happen.

Environment:

Screenshots If applicable, add screenshots to help explain your problem.

Logger Output


2024-01-03T06:47:34.109Z [Error] Syntax error in query/invoke request. Chaincode arguments supplied: ['"asset1"','"function (old_index, new_index) {
    // Shortcut helper to move item to end of array
    if (-1 === new_index) {
        new_index = this.length - 1;
    }

    if (new_index >= this.length) {
        var k = new_index - this.length;
        while (k-- + 1) {
            this.push(undefined);
        }
    }
    this.splice(new_index, 0, this.splice(old_index, 1)[0]);
    return this; // for testing purposes
}"'].
ashwath-spdr commented 6 months ago

@Nova38 , Thanks for reporting the issue.

This is pretty weird.. I am thinking that there could be some special character in the file which might be messing up with the parsing of the .fabric file.

Can you please attach the actual .fabric file to the issue so that I can take a look?