Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rest-api-typescript getting error #962

Open
sohailrafique2017 opened this issue Feb 24, 2023 · 2 comments
Open

rest-api-typescript getting error #962

sohailrafique2017 opened this issue Feb 24, 2023 · 2 comments

Comments

@sohailrafique2017
Copy link

EnvVarError: env-var: "HLF_CONNECTION_PROFILE_ORG1" is a required variable, but it was not set. An example of a valid value would be: {"name":"test-network-org1","version":"1.0.0","client":{"organization":"Org1" ... }
at raiseError (/Users/mac/Documents/projects/company/hyperledger/hyperledger_typscript/network/apis/node_modules/env-var/lib/variable.js:47:11)
at Object.asJsonObject (/Users/mac/Documents/projects/company/hyperledger/hyperledger_typscript/network/apis/node_modules/env-var/lib/variable.js:64:11)
at Object. (/Users/mac/Documents/projects/company/hyperledger/hyperledger_typscript/network/apis/src/config.ts:187:4)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (/Users/mac/Documents/projects/company/hyperledger/hyperledger_typscript/network/apis/src/index.ts:9:1)

@sohailrafique2017
Copy link
Author

How Can I set env variables HLF_CONNECTION_PROFILE_ORG1??

@caner-emec
Copy link

@sohailrafique2017
In the readme file it says:
"Create a .env file to configure the server for the test network (make sure TEST_NETWORK_HOME is set to the fully qualified test-network directory)"
TEST_NETWORK_HOME=$HOME/fabric-samples/test-network npm run generateEnv

https://github.com/hyperledger/fabric-samples/blob/main/asset-transfer-basic/rest-api-typescript/scripts/generateEnv.sh
If you want to create manually, you can review the above file. The code here shows how the env. variable is created.

Or you can just try to export the created .env file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants