Dashes are legal in IBM Cloud operational tooling for naming channels (and chaincode), but breaks this scaffolding (discovered with the last JavaScript scaffold). It causes an error at runtime that is not easy to track down.
Steps to repeat - in the IBM Cloud create a channel named asset-transfer-channel (legal in IBM Cloud operational tooling... in fact some notes from the GUI specifically say dashes are allowed... try using a capital letter in the name of a new channel and the note appears saying "The channel name can contain only lowercase characters, numbers, or dashes, and should start with a letter.").
You can create a chain code package via the IBP plugin with a name also that includes dashes (like asset-tracker).
For the scaffolding, in any controller file, you would then need the line:
const contract = res.locals.asset-transfer-channel.asset-tracker;
This will break when the code reaches this line.
Creating a new channel with no dashes in the name, and re-packaging the chaincode without dashes fixes the problem. BUT now I have a 'garbage' channel (the old one with dashes) in my blockchain infrastructure that is inaccessible if I want to use the scaffolding.
The renaming of a chaincode package is not so big a deal... but because a channel can't be deleted, now I have 'scrap' in (what could be) a production network... or, again, I can't use the scaffolding to connect to it.
If you know all this AHEAD OF CREATING THE BLOCKCHAIN constructs, it's fine of course. But that is not a reasonable expectation.
This was found in JavaScript scaffolding (an older hash of this repo - - 6b81c54)... but if it still exists in the current scaffold I think this should be corrected. (if dashes are illegal in the 'dot' notation used to create the contract object, then maybe another method can be used? )
Dashes are legal in IBM Cloud operational tooling for naming channels (and chaincode), but breaks this scaffolding (discovered with the last JavaScript scaffold). It causes an error at runtime that is not easy to track down.
Steps to repeat - in the IBM Cloud create a channel named asset-transfer-channel (legal in IBM Cloud operational tooling... in fact some notes from the GUI specifically say dashes are allowed... try using a capital letter in the name of a new channel and the note appears saying "The channel name can contain only lowercase characters, numbers, or dashes, and should start with a letter.").
You can create a chain code package via the IBP plugin with a name also that includes dashes (like asset-tracker).
For the scaffolding, in any controller file, you would then need the line:
const contract = res.locals.asset-transfer-channel.asset-tracker;
This will break when the code reaches this line.
Creating a new channel with no dashes in the name, and re-packaging the chaincode without dashes fixes the problem. BUT now I have a 'garbage' channel (the old one with dashes) in my blockchain infrastructure that is inaccessible if I want to use the scaffolding.
The renaming of a chaincode package is not so big a deal... but because a channel can't be deleted, now I have 'scrap' in (what could be) a production network... or, again, I can't use the scaffolding to connect to it.
If you know all this AHEAD OF CREATING THE BLOCKCHAIN constructs, it's fine of course. But that is not a reasonable expectation.
This was found in JavaScript scaffolding (an older hash of this repo - - 6b81c54)... but if it still exists in the current scaffold I think this should be corrected. (if dashes are illegal in the 'dot' notation used to create the contract object, then maybe another method can be used? )