imperative
imperative copied to clipboard
Invalid error details when the Zowe CLI method is called from TypeScript
We are calling multiple Zowe CLI methods from TypeScrict code. When one of them fails,
the error details show invalid command that is entered (zowe
+ arguments of our program - test.json
).
Knowing the method that has failed would be helpful to us.
Error: socket hang up
at connResetException (internal/errors.js:609:14)
at TLSSocket.socketOnEnd (_http_client.js:453:23)
at TLSSocket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Command Error:
socket hang up
Imperative encountered an unexpected exception
Command entered: "zowe test.json"
Use "zowe test.json undefined --help" to view groups, commands, and options.
Error Details:
socket hang up
Example of how we call the Zowe methods: https://github.com/plavjanik/zowe-zosmf-perftest-driver/blob/master/src/index.ts#L153
I'm not sure what's going on. If you're using SDK code / library methods (old or new) you shouldn't get Zowe CLI "Command Error".
It looks like you actually call the test method you linked here, https://github.com/plavjanik/zowe-zosmf-perftest-driver/blob/master/src/index.ts#L276
Does the error fall into your catch
block? If not, are you getting to this line https://github.com/plavjanik/zowe-zosmf-perftest-driver/blob/master/src/index.ts#L302 ?
I am not sure when they are logged. Usually, I can see them just before the program ends.
Try/catch block sometimes shows the real issue. For example:
{"message":"User #0 aicji01 - Request 3 - Test FileUpload: {\"success\":false,\"exception\":{\"mDetails\":{\"msg\":\"z/OSMF REST API Error:\\nRest API failure with HTTP(S) status 404\\ncategory: 6\\nrc: 8\\nreason: 93651005\\nmessage: File not found.\\ndetails: \\n - EDC5129I No such file or directory. (errno2=0x0594003D)\\n\\n\",\"causeErrors\":\"{\\\"category\\\":6,\\\"rc\\\":8,\\\"reason\\\":93651005,\\\"message\\\":\\\"File not found.\\\",\\\"details\\\":[\\\"EDC5129I No such file or directory. (errno2=0x0594003D)\\\"]}\",\"source\":\"http\",\"errorCode\":404,\"port\":1443,\"host\":\"ca32.lvn.broadcom.net\",\"basePath\":\"\",\"httpStatus\":404,\"headers\":[{\"Content-Type\":\"text/plain\"},{\"X-CSRF-ZOSMF-HEADER\":true}],\"resource\":\"/zosmf/restfiles/fs/a%2Faicji01%2Fzztop%2Ftest0.txt\",\"request\":\"PUT\",\"additionalDetails\":\"HTTP(S) error status \\\"404\\\" received.\\nReview request details (resource, base path, credentials, payload) and ensure correctness.\\n\\nHost: ca32.lvn.broadcom.net\\nPort: 1443\\nBase Path: \\nResource: /zosmf/restfiles/fs/a%2Faicji01%2Fzztop%2Ftest0.txt\\nRequest: PUT\\nHeaders: [{\\\"Content-Type\\\":\\\"text/plain\\\"},{\\\"X-CSRF-ZOSMF-HEADER\\\":true}]\\nPayload: undefined\"},\"mMessage\":\"z/OSMF REST API Error:\\nRest API failure with HTTP(S) status 404\\ncategory: 6\\nrc: 8\\nreason: 93651005\\nmessage: File not found.\\ndetails: \\n - EDC5129I No such file or directory. (errno2=0x0594003D)\\n\\n\"}}","level":"error","service":"user-service"}
But sometimes we don't know what went wrong. For example:
{"message":"User #3 tnzsys - Request 96 - Test ConsoleCommand: {\"success\":false,\"exception\":{}}","level":"error","service":"user-service"}
We can see these errors also in the imperative log. Something similar is produced for both errors shown before,
[2020/11/24 02:34:46.346] [INFO] [CommandProcessor.js:248] Invoking command "zowe test.json"...
[2020/11/24 02:34:46.347] [INFO] [CommandProcessor.js:249] Command issued:
zowe test.json
[2020/11/24 02:34:46.348] [INFO] [CommandProcessor.js:259] Preparing (loading profiles, reading stdin, etc.) execution of "zowe test.json" command...
[2020/11/24 02:34:46.349] [DEBUG] [SharedOptions.js:61] Standard input reading not requested. Skipping stdin read
[2020/11/24 02:34:46.349] [INFO] [CommandProfileLoader.js:81] Request to load profiles for command: zowe test.json...
[2020/11/24 02:34:46.350] [INFO] [CommandProcessor.js:199] Performing syntax validation for command "zowe test.json"...
[2020/11/24 02:34:46.351] [INFO] [CommandProcessor.js:417] Invoking process method of handler for "zowe test.json" command.
[2020/11/24 02:34:46.351] [INFO] [CommandProcessor.js:629] Requiring handler "/u/tnzsys/zowe-test/zztop/node_modules/@zowe/imperative/lib/cmd/src/yargs/../handlers/FailedCommandHandler" for command "/u/tnzsys/zowe-test/zztop/node_modules/@zowe/imperative/lib/cmd/src/yargs/../handlers/FailedCommandHandler"...
[2020/11/24 02:34:46.351] [INFO] [CommandProcessor.js:632] Handler "/u/tnzsys/zowe-test/zztop/node_modules/@zowe/imperative/lib/cmd/src/yargs/../handlers/FailedCommandHandler" for command "zowe test.json" successfully loaded/required.
[2020/11/24 02:34:46.352] [ERROR] [CommandProcessor.js:696] Handler for command "zowe test.json" failed.
[2020/11/24 02:34:46.352] [ERROR] [CommandProcessor.js:700] Diagnostic information:
Platform: 'os390', Architecture: 's390x', Process.argv: '/PPS247/usr/lpp/nodejs/node-v12.18.0-os390-s390x/bin/node /u/tnzsys/zowe-test/zztop/node_modules/.bin/zztop test.json'
Node versions: '{
"node": "12.18.0",
"v8": "7.8.279.23-node.37",
"uv": "1.37.0",
"zlib": "1.2.11",
"brotli": "1.0.7",
"ares": "1.16.0",
"modules": "72",
"nghttp2": "1.41.0",
"napi": "6",
"llhttp": "2.0.4",
"http_parser": "2.9.3",
"openssl": "1.1.1g",
"cldr": "37.0",
"icu": "67.1",
"tz": "2019c",
"unicode": "13.0"
}'Environmental variables: '{
"MAIL": "/usr/mail/TNZSYS",
"HOSTNAME": "PATP21",
"ZOWE_ZOSMF_PATH": "/var/zosmf/configuration/servers/zosmfServer/",
"ZOWE_IPADDRESS": "9.12.44.121",
"_LIBDIRS": "/lib /usr/lib",
"outdir": "/u/handson/results",
"PATH": "/u/tnzsys/zowe-test/zztop/node_modules/.bin:/usr/lpp/nodejs/node-v12.18.0-os390-s390x/bin:/usr/lpp/nodejs/node-v12.18.0-os390-s390x/bin/:.:/usr/sbin:/bin:/u/java/JDKs/bin:/usr/local/bin:/usr/local/sbin:/u/tnzsys/bin:/u/tnzsys:/u/handson/results:/u/tools:/u/tools/bin",
"_BPXK_AUTOCVT": "ON",
"SHELL": "/bin/sh",
"PERF_TIMING_TO_MAX_HISTORY": "1",
"DEBUG": "*",
"_INCDIRS": "/usr/include /usr/lpp/ioclib/include",
"_WORK_UNIT": "SYSDA",
"ZOWE_ZOSMF_PORT": "00443",
"NODE_HOME": "/usr/lpp/nodejs/node-v12.18.0-os390-s390x",
"DISABLE_NODEJS_SMF89_REGISTRATION": "1",
"_PLIB_PREFIX": "CEE",
"ZOWE_EXPLORER_HOST": "PATP21.POK.STGLABS.IBM.COM",
"PS1": "$LOGNAME@$HOSTNAME: $PWD > ",
"_CEE_RUNOPTS": "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)",
"_BPX_SPAWN_SCRIPT": "YES",
"APP_LIBPATH": "/u/java/JDKs04/j9v53_61002w/sdk/jre/bin",
"_": "/usr/lpp/nodejs/node-v12.18.0-os390-s390x/bin/npx",
"LOGNAME": "TNZSYS",
"LANG": "C",
"LIBPATH": "/lib:/usr/lib:.:/PPS247/usr/lpp/nodejs/node-v12.18.0-os390-s390x/bin/obj.target/:/PPS247/usr/lpp/nodejs/node-v12.18.0-os390-s390x/lib/:/PPS247/usr/lpp/nodejs/node-v12.18.0-os390-s390x/bin",
"PERF_TIMING_ENABLED": "TRUE",
"ZOWE_JAVA_HOME": "/PPS23C/usr/lpp/java/J8_64_SR5/J8.0_64",
"prompt": "PATP21':'TNZSYS':'/u/tnzsys':';]- ",
"_SLIB_PREFIX": "SYS1",
"PERF_TIMING_IO_SAVE_DIR": ".",
"_BPX_SHAREAS": "YES",
"_CLIB_PREFIX": "CBC",
"HOME": "/u/tnzsys",
"JAVA_HOME": "/u/java/JDKs04/j9v53_61002w/sdk/jre",
"TZ": "EST5EDT",
"MANPATH": "/usr/man/%L:/usr/local/man/%L",
"NLSPATH": "/usr/lpp/tcpip/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N",
"_EDC_SIG_DFLT": "1"
}'
[2020/11/24 02:34:46.353] [ERROR] [CommandProcessor.js:708] Handler for zowe test.json rejected by thrown ImperativeError.
[2020/11/24 02:34:46.353] [INFO] [CommandProcessor.js:684] Command "zowe test.json" completed with success flag: "false"
[2020/11/24 02:34:46.354] [DEBUG] [YargsConfigurer.js:211] Finished invoking the 'FailedCommand' handler
This is the root cause https://github.com/zowe/zowe-cli/issues/865
Assigned the same labels as the issue identified as the root cause: https://github.com/zowe/zowe-cli/issues/865
Closing in favor of zowe/zowe-cli#865